[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Convert array to function
From: |
Marco |
Subject: |
Re: Convert array to function |
Date: |
Fri, 19 Dec 2014 17:03:58 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On 2014–12–19 Juan Pablo Carbajal wrote:
> If I understand your problem you can interpolate linearly your points,
> getting the polynomial and then evaluate using ppval.
> This is done by the function
> data2fun in the signal package
> http://octave.sourceforge.net/signal/function/data2fun.html
>
> But you can do it manually by
>
> pp = interp1 (x,y,"linear","pp");
>
> and then
> func = @(x) ppval (pp,x);
Thank you as well for your quick answer. As I already wrote to
Allen's response, the interp1 function is exactly what I need
possibly combined with the f= @(x) … trick.
Marco