How to find parameters of implicit function?

2 views (last 30 days)
Jernej
Jernej on 18 Jun 2014
I have to find parameters a and b of this implicit function y=1614413.7*(coth((x+b*y)/a)-a/(x+b*y)).
This function best describes my data. So far I have written this code:
function y=deviskaF(x,p)
y=zeros(size(x)); NN=length(x); opt=optimset('display','off');
for i=1:NN y(i)=fsolve(@(y) y-1.5e6*(coth((x(i)+p(2)*y)./p(1))-(p(1)./(x(i)+p(2)*y))), .1, opt); end end
Then I call this function in lsqcurvefit in matlab command window.
lsqcurvefit(@(params, xdata) deviskaF(xdata,params),[10 1e-6], x, y)
Parameter a should be somewere around 10 and parameter B around 10^-6. The results are far away from predicted results and I also get this message:
Local minimum possible.
lsqcurvefit stopped because the size of the current step is less than the default value of the step size tolerance.
What am I doing wrong?

Answers (0)

Community Treasure Hunt

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

Start Hunting!