Your data as given doesn't lead to a very good fit. Here is what I found:
xdata = [ 5.45 6.2 10.15 10.9 11.65 15.55 16.3 17.05 20.83 21.58 22.33 26.16 26.91 27.67 31.8 32.6 33.3 37.15 37.9 38.6];
ydata = [ 11.23 7.22 6.95 6.7 6.66 5.82 5.76 5.8 5.3 5.11 5.63 5.44 5.82 5.79 5.44 5.65 5.52 5.59 5.55 5.51 ];
fun = @(x,xdata)x(1)*xdata.^x(2);
x0 = [2,-0.5];
[x,res] = lsqcurvefit(fun,x0,xdata,ydata)
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.
<stopping criteria details>
x =
14.4106 -0.2930
res =
11.6140
However, plotting the curve showed that the first point looked like an outlier.
plot(xdata,ydata,'ko',xdata,fun(x,xdata),'b-')
Removing the first point gives a better fit.
xd2 = xdata(2:end);
yd2 = ydata(2:end);
[x2,res2] = lsqcurvefit(fun,x0,xd2,yd2)
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.
<stopping criteria details>
x2 =
9.5469 -0.1618
res2 =
1.6879
figure;plot(xd2,yd2,'ko',xd2,fun(x2,xd2),'b-')
Not great, but better.
I did this using the Optimization Toolbox lsqcurvefit function, but the idea is the same no matter what you use to do the fit.
Alan Weiss
MATLAB mathematical toolbox documentation