You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Srikanth Kannan <sr...@gmail.com> on 2010/06/07 20:39:33 UTC

[math] implementation of (1D interpolation) interp1 function of MATLAB in Apache Commons

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 ?

Regards
Srikanth Kannan

Re: [math] implementation of (1D interpolation) interp1 function of MATLAB in Apache Commons

Posted by Srikanth Kannan <sr...@gmail.com>.
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
answer as 2.54

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 <Lu...@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
>
>

Re: [math] implementation of (1D interpolation) interp1 function of MATLAB in Apache Commons

Posted by Luc Maisonobe <Lu...@free.fr>.
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