Search code examples
matlableast-squaresinterceptionloglog

Finding the gradient and interception point in Matlab


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


Solution

  • polyfit returns two values the gradient and intercept.