help-octave
[Top][All Lists]
Advanced

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

polyfit polynomial coefficiencts--don't understand output


From: sameb
Subject: polyfit polynomial coefficiencts--don't understand output
Date: Fri, 14 Oct 2011 16:35:22 -0700

Greetings all,

I'm trying to perform a linear regression analysis using polyfit and
polyval. polyfit is not performing the way I expected. Here's a bit of
code...

x = [0,1,2,3,4];
y = x;
[p,s,mu] = polyfit(x,y,1);
[y1,dy] = polyval(p,x,s,mu);
plot(x,y,'o',x,y1,'-')
p 

and I'm thoroughly confused of the output p = [1.5,2]
I thought it should be [1,0]. What's wrong? The plot looks correct.

Thanks,

Sam



reply via email to

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