I'm trying to fit a curve in matlab using fit in command line. The input data is:
And the target function is
I am using fittype, fitoptions, and fit as follow:
model1 = fittype('1/(kappa*x.^pow)');
opt1 = fitoptions(model1);
opt1.StartPoint = [1e-5 -2];
[fit1,gof1] = fit(X,Y.^-1,model1,opt1)
I get results with rsquare of roughly -450 which are vaguely in the same direction as the measurement.
A plot of Y as a function of X in a log log scale, yield an almost linear plot. The resulting fit however, has a smaller slope (closer to 0) and is higher than any of the data points (almost twice as high as highest data point). It is needless to say that the line doesn't cross any of the data point.
How can I generate better quality of data fitting?
When I try to fit the results to
I get a good result with pow being roughly -1.5.
But if I try to fit to:
I get a poor result. Why is that so?