help-octave
[Top][All Lists]
Advanced

[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:01:24 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On 2014–12–19 address@hidden wrote:

> Linear interpolation using interp1 works.

Thanks, interp1 is exactly what I need.

> % Make a function from the table:
> octave:11> f = @(x) interp1(xx, yy, x);
> 
> % See if it works:
> octave:11> x = 0:0.5:10
> octave:12> y = f(x);
> octave:13> plot(x,y)

Thank your for this detailed step-by-step solution. It's clean an
elegant and much less ugly that what I have attempted before. (I'm
new to octave as you might have noticed.)

> % Success!

Indeed. That helped me to solve my problem. The essential bits were
that I tried using polyfit and didn't know about interp1. And I
didn't know about the table → function trick.

Thank you very much.

Cheers,
Marco



reply via email to

[Prev in Thread] Current Thread [Next in Thread]