Curve fitting problem and strange message

Hello everyone,
I tried to fit my peak with Lorentzian however the background can't be fitted well:
the background of the fitted curve is always lower than the real data.
I used a bound range [0 inf] for this background coefficient and TolFun=1e-25 and TolX=1e-25 for the fitoptions.
Even the fitting is obviously poor as above and matlab still finished with this message:
Success, but fitting stopped because change in residuals less than tolerance (TolFun).
Really don't know how to optimize it. Thanks for any suggestions.
BTW, does anyone know how to post an image here? I wish to attach my fitting curve here.

3 件のコメント

José-Luis
José-Luis 2013 年 5 月 23 日
Sometimes it is impossible to get a good fit. In your case though, the tolerance is quite low and it should give decent results (provided it converges), unless the values you are trying to fit are themselves very small.
Could you post a minimum working example?
Image Analyst
Image Analyst 2013 年 5 月 24 日
Did you use the Curve Fitting Toolbox for this? If so, list it in the products list below.
Fei
Fei 2013 年 5 月 24 日
No, I created routines to fit the data.

サインインしてコメントする。

回答 (1 件)

Craig Cowled
Craig Cowled 2013 年 5 月 24 日

0 投票

Fei, if the "change in residuals is less than tolerance" then this is an indication that you have a reasonably good fit.
I have recently discovered the LSQNONLIN function which is a very quick way to find an optimal solution. Have a look at the code I posted in http://www.mathworks.com.au/matlabcentral/answers/60638-curve-fitting-a-complex-function-using-cftool. It might give you an alternative approach to the problem.
Craig.

カテゴリ

ヘルプ センター および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

タグ

質問済み:

Fei
2013 年 5 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by