How to do curve fitting in my situation

function specialcurve = MagCurv(Js,H0,A,H1,H2,n,B,H3,H4)
specialcurve = @mfunc;
function J = mfunc(H)
J = Js*atan(H./H0)*2/pi.*(1-A*exp(-((H+H1)/H2).^n)).*(1-B*exp(-((log(H+eps)-...
log(H3))/log(H4)).^2));
end
end
Now I have raw data of H and J (array 1*23) and I want to get parameters(Js,H0,A,H1,H2,n,B,H3,H4) through curve fitting. Is that possible?
Thanks a lot!

Answers (1)

Matt J
Matt J on 9 Oct 2013
LSQCURVEFIT, if you have it, would be applicable.

3 Comments

Thanks for replying! But how? I have my main function only delivering a handle of sub function and I have rawdata of H and J, both of them are array and used in sub function. But I need to get Js,H0,A,H1,H2,n,B,H3,H4 in the main function through curve fitting
I mean using of lsqcurvefit is that the function have a format of
J = myfunc(x,H)
where H and J is known and you use lsqcurvefit to get x
Combine your unknowns into a single vector
x=[Js,H0,A,H1,H2,n,B,H3,H4]
and similarly with your data

Sign in to comment.

Categories

Asked:

on 9 Oct 2013

Commented:

on 10 Oct 2013

Community Treasure Hunt

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

Start Hunting!