필터 지우기
필터 지우기

fitting a logarithmic data

조회 수: 5 (최근 30일)
sally adin
sally adin 2015년 5월 8일
답변: Ingrid 2015년 5월 8일
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
Michael Haderlein
Michael Haderlein 2015년 5월 8일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Ingrid
Ingrid 2015년 5월 8일
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);

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by