Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

curve fitting tool box

Asked by ahmed on 31 Jul 2013

Hi all,

there is something i don't understand in the curve fitting tool box, i have :

x= [1 2 3 4];

y= [1 2 3 4];

after using the curve fitting tool box this is the results comes out:

Linear model Poly1:

     f(x) = p1*x + p2
       where x is normalized by mean 3.5 and std 1.871
Coefficients (with 95% confidence bounds):
       p1 =       1.871  (1.871, 1.871)
       p2 =         3.5  (3.5, 3.5)

Goodness of fit:

SSE: 2.81e-30
R-square: 1
Adjusted R-square: 1
RMSE: 8.382e-16

the plotted graph on the right is correct but the resulted equation is not correct !!!!! ??

Thanks.

1 Comment

Tom Lane on 1 Aug 2013

What do you do with the Curve Fitting Toolbox? If I type

fit(x',y','poly1')

I get a slope of 1 and an intercept that is zero (tiny number).

ahmed

Products

No products are associated with this question.

1 Answer

Answer by dpb on 2 Aug 2013
Edited by dpb on 2 Aug 2013

Of course the equation is right--as the message says p1 and p2 are coefficients for the normalized x. Substitute in z=(x-3.5)/1.871 and solve for m and b in terms of z and you'll find that

 m=p1/1.871 --> 1
 b=p2+3.5   --> 0

In the tool it's the "Center and Scale" checkbox that controls it; at the command line the fit option 'Normalize', 'on|off'

0 Comments

dpb

Contact us