0

I have a problem finding the interception point from a log-log plot in Matlab using the "least square method".

I have the following in Matlab:

a=[69.5;94.5;128.5];
b=[11.12;10.21;9.34];
loglog(a,b)
C=polyfit(log(a),log(b),1)

My objective is to find the gradient of the line in the log-log plot, and tho find the intersection point. I believe the polyfit gave me the gradient (-0.2838), but I do not find the interseption point. Is there an easy way to do this?

Regards, David

David
  • 159
  • 8

1 Answers1

0

polyfit returns two values the gradient and intercept.

matlabgui
  • 5,642
  • 1
  • 12
  • 15
  • Okay, thank you for your reply. The first value is the gradient. The second value it gives me is 3.61. My interception point should be about 30. What does the 3.61 tell me? – David Apr 13 '16 at 13:35
  • You have found the gradient of `log(b)` v `log(a)` - where as you are plotting the data `b v a` on a logscale - its not he same thing. Hence why the intercept is not what you were expecting – matlabgui Apr 13 '16 at 13:57
  • Okay. Thank you for your help. – David Apr 13 '16 at 18:20