Filter löschen
Filter löschen

fitting data with equation

1 Ansicht (letzte 30 Tage)
sarah
sarah am 29 Mai 2015
Kommentiert: Star Strider am 30 Mai 2015
Hi guys, so I have alot of experimental data in column matrix y. And I want to use the equation below to find the best fit for my data y. This means have constant b adjusted with x varying, I know that x typically ranges from 1 to 5 with y and b ranges from 0 to 2.
I'm thinking of using a double loop. Would anyone give me tips on how to solve for it effectively? Thanks in advance. The equation is:
y= (1-0.05*x^(b))/(1-0.05*x^b)^2

Akzeptierte Antwort

Star Strider
Star Strider am 29 Mai 2015
I would use a nonlinear curve fitting function such as nlinfit, lsqcurvefit (or fminsearch indirectly).
However if your (x,y)>0, are not noisy, y>1, and you want an estimate of ‘b’, this might work:
b = log(20*(1-1./y))./log(x);
Otherwise, use a nonlinear parameter estimation routine.
  4 Kommentare
sarah
sarah am 30 Mai 2015
And may I ask how did you derive this expression? Thanks
Star Strider
Star Strider am 30 Mai 2015
Sure!
y = (1-0.05*x^b)/((1-0.05*x^b)^2
(1/y) = 1-0.05*x^b
(1-(1/y))*20 = x^b
x = ((1-(1/y))*20)^(1/b)
Then vectorise it to do the calculation:
x = ((1-(1./y))*20).^(1./b);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Least Squares finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by