フィルターのクリア

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 Center および File ExchangeGet 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