Filter löschen
Filter löschen

fitting a logarithmic data

5 Ansichten (letzte 30 Tage)
sally adin
sally adin am 8 Mai 2015
Beantwortet: Ingrid am 8 Mai 2015
I wanted to fit my data of J and E with
lopt=fitoptions('Method','NonlinearLeastSquares','Lower',[1e-18 1e-12 -100 1e-75 0],'StartPoint',[1e-18 1e-12 -100 1e-75 0],'Upper',[1e-16 1e-10 0 1e-60 10])
lopt.DiffMinChange=1e-15; lopt.DiffMaxChange=1e5; mylfittype=fittype('b*exp(-c/x)+d*exp(f*x)','options',lopt) mylfit=fit(J,E,mylfittype,'-')
However I keep on getting an error message
Error using fit>iParseOptionalArgs (line 975) Algorithm options must be specified in a FITOPTIONS object or as property-value pairs.
What I am doing wrong. Also I want to fit another set of x and y with
fop=fitoptions('Method','NonlinearLeastSquares','Lower',[1e-5,1.5e-4],'StartPoint',[3e-5,1.6e-4],'Upper',[1.5e-4,1e-1]); myftype=fittype('0.024.*(log(x/a+1))+b*x','options',fop); myf=fit(Jrec,Vn,myftype) Jcoeff= coeffvalues(myf);
This does the fit but it gives me not a good one. I suscpect the method is not best for my data. I was interested in doing piecewise (which I was suggested) but I don't know how to.
Please help
  1 Kommentar
Michael Haderlein
Michael Haderlein am 8 Mai 2015
Please use the {}Code button top of the edit window to format your code in a readable manner. It's difficult to say anything about a code which is hardly readable.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ingrid
Ingrid am 8 Mai 2015
since you are tring to do a nonlinear regression why don't you use nlinfit?
ownFunc = @(A,x) A(1)*exp(-A(2)/x)+A(3)*exp(A(4)*x);
A0 = ones(4,1); % provide good starting values appropriate for your case here
[beta,R,J,CovB,MSE,ErrorModelInfo] = nlinfit(J, E, ownFunc, A0);

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox 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