# commons-user mailing list archives

##### Site index · List index
Message view
Top
From Srikanth Kannan <srikanth...@gmail.com>
Subject Re: [math] implementation of (1D interpolation) interp1 function of MATLAB in Apache Commons
Date Tue, 08 Jun 2010 01:07:30 GMT
Thanks a lot Luc. Sorry to ask again, but i am not sure. Which is the best
method to use for linear interpolation (which is used by interp1 of Matlab).

For example, if i am given two arrays x = {1,2,3,4,5}, which is the domain
and y={1,8,27,64,125}, which is the range(function is cube).Now, to find the
value of y for x= 1.22, i use the interp1 method in Matlab, and get the

ans = interp1(x,y,1.22) = 2.54. (but, the cube of 1.22 is 1.8158) . I need
to do this as Matlab's interp1 does. Any idea of how should i implement this
?

Regards
Srikanth Kannan

On Mon, Jun 7, 2010 at 15:11, Luc Maisonobe <Luc.Maisonobe@free.fr> wrote:

> Le 07/06/2010 20:39, Srikanth Kannan a écrit :
> > Hi,
> >
> > i am looking to implement the interp1, 1-D data interpolation (table
> > lookup), function available in MATLAB in J2ME or JAVA. Here is the link
> of
> > what interp1 does
> >
> > http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html
> >
> > Is there any method in Apache Common-Math library which has already
> > implemented the same function ? If not can anybody help me in
> implementing
> > 'interp1' function in J2ME or JAVA ?
>
> There are several different interpolation methods in the
> org.apache.commons.math.analysis.interpolation package for univariate,
> bivariate, trivariate and multivariate functions.
>
> There are also curve fitting algorithms in the
> org.apache.commons.math.optimization.fitting package.
>
> Hope this helps,
> Luc
>
> >
> > Regards
> > Srikanth Kannan
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
• Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message