help-octave
[Top][All Lists]
Advanced

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

Re: Plotting Least Squares Regression


From: Ben Abbott
Subject: Re: Plotting Least Squares Regression
Date: Fri, 7 Dec 2007 20:59:25 -0500


On Dec 7, 2007, at 8:04 PM, Ciaran Mooney wrote:

Evening,

I've gotten a bit further with my problem. I have found a forum post
[http://forum.mandriva.com/viewtopic.php? t=17602&highlight=&sid=ad0cf06d91bca350253fe355201262ae]
that seems to detail what I want to do.

I have successfully plotted a graph, and a line of best fit, that to
me looks alright.

When I type "p" at the prompt to find out what "polyfit(x,y)" has
given me I get two values, in the equation y=mx+c, are these values m
and c??

CiarĂ¡n, the polyfit/polyval functions for Octave are intended to be consistent with the same in Matlab.

http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/ access/helpdesk/help/techdoc/ref/polyfit.html&http://www.google.com/ search?q=matlab%20polyfit&sourceid=mozilla2&ie=utf-8&oe=utf-8

Thus is "p" has a length of 2, p(1) = m and p(0) = c.

You can fit to polynomials of a larger order using p = polyfit (x,y,N) .... where N = the order of the polynomial.

Thus, the answer to your question is "yes". Provided you meant "polyfit(x,y,1)"

Ben


reply via email to

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