[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Q: Error in function polyfit() ???
From: |
Mario Storti |
Subject: |
Re: Q: Error in function polyfit() ??? |
Date: |
Thu, 04 Sep 1997 09:28:31 -0300 |
> Hello,
>
> i used the function polyfit(). I found it is buggy.
> I test it with
> x=1:10;
> y=x;
> [p, value] = polyfit(x,y, 4);
>
> and i got strange results.
> Is a replacement for polyfit() aviable.
>
> Franz-Josef
polyfit() returns the vector of coefficients of the lest square
polynomial of order "n". You should call polyval() afterwards:
> x=1:10;
> y=x;
> p = polyfit(x,y, 4);
> value= polyval(p,4)
Here you compute the Least Squares fitted polynomial of 4rd order and
then eval to obtain the value at x=4.
Cheers,
Mario
%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%
Mario Alberto Storti | Fax: (54)(42) 55.09.44 |
Grupo de Tecnologia Mecanica | Tel: (54)(42) 55.91.75 |
INTEC, Guemes 3450 - 3000 Santa Fe | Home: Gob. Vera 3161 |
Argentina | (54)(42) 55.00.23|
Reply: address@hidden | |
http://venus.unl.edu.ar/gtm-eng.html |