MATLAB: How to fit the data if I know the relationship of x and y, but don’t have expression form of y=…..

curve fittingleast square fit

I have the xdata=[…], ydata=[….], and I want to fit it in the expression of: bx^(y-1)+((x+5.637)^(y-2))/1000=a (a and b are the fitting parameters)

Best Answer

Use polyfit. Seriously. Your model is a linear one in those parameters. Here is your model:
((x+5.637)^(y-2))/1000 = a + b*(-x^(y-1))
Solve it in one line:
ba = polyfit(-xdata.^(ydata-1),((xdata+5.637),^(ydata-2))/1000,1);
b = ba(1);
a= ba(2);
Related Question