0
votes

I would like to know the MATLAB code form of the power polynomial y = xm.
I require the numerical value of m by fitting this curve to a set of data. My initial program is as follows:

load A   
N = A(:, 1);
t = A(:, 2);    
p = polyfit(log(N), log(t), 1);    
f = (p, t);    
plot(t, N, '-', t, f, '-');

My only doubt is the above polyfit function used for curve fitting is for the equation y = bxm which is not fitting my data set, where I require b = 1.

1

1 Answers

0
votes

Third parameter of polyfit is degree of polynomial, m in your case.

You can pass parameter larger than m to polyfit. Then, if your assumption about model is correct p[m + 1] will be the largest component of p (and close to 1), while others should be close to zero.