Effacer les filtres
Effacer les filtres

fitting a logarithmic data

5 vues (au cours des 30 derniers jours)
sally adin
sally adin le 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 commentaire
Michael Haderlein
Michael Haderlein le 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.

Connectez-vous pour commenter.

Réponses (1)

Ingrid
Ingrid le 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);

Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by