help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Polynomial interpolation


From: Doug Stewart
Subject: Re: Polynomial interpolation
Date: Tue, 23 Jun 2015 00:11:50 -0400



On Mon, Jun 22, 2015 at 11:14 PM, Tatsuro MATSUOKA <address@hidden> wrote:
----- Original Message -----

>From: Ariana del Tor
>To: Cinthia Mesquita Pinke Cavalcanti
>Cc: "help
>Date: 2015/6/23, Tue 09:22
>Subject: Re: Polynomial interpolation
>
>
>http://www.mathworks.com/help/matlab/ref/polyfit.html
>
>Please see the first example. You need to feed polyfit two vectors, x and y of the same size. 
>
>
>so define x and y separately in your case it looks like:
>
>
> x = [1, 2, 3, 4, ....]
>y = [ 73, 99, 90, 24...]
>
>
>
>and finally n is the number of points you want to fit the array to. n can equal up to # of point - 1.
>
>
>On Mon, Jun 22, 2015 at 1:15 PM, Cinthia Mesquita Pinke Cavalcanti <address@hidden> wrote:
>
>Dear Sir/ Madam
>> 
>>I am new to Octave, and I was not able to work with the polyfit function.
>>I have the matrix listed below and I want to find  the polynomial coefficients that fit to the points x,y:
>> 
>> 
>>What should I do?
>> 
>>Thanks in advance,
>> 
>> 
>>Cínthia Pinke
>> 
>Ariana del Toro
>DATA ANALYST
>address@hidden  



Note

polyfit is not a function for polynomial interpolation but a function of 
polynomial curve fitting.

Wiki
polynomial interpolation

https://en.wikipedia.org/wiki/Polynomial_interpolation


Curve fitting

https://en.wikipedia.org/?title=Curve_fitting


Tatsuro

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave

Here is one example with N=5
You can try other values.

x = [1, 2, 3, 4,5,7,8,9,10,11,12];
y = [ 73, 99, 90, 24,18,25,16,31,32,74,92];
p=polyfit(x,y,5)
xx=0:.1:13;
v=polyval(p,xx);
plot(xx,v,x,y,'o')


--
DASCertificate for 206392


reply via email to

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