How to fit a custom function using nlinfit?
古いコメントを表示
I have written a function 'fun' in a separate .m file that I would like to fit to some xy data, using a parameter 'A' as a fitting parameter. However, since the function depends on the input of xdata and the parameter A to run, I am no sure how to fit it using nlinfit (or similar). When I enter the following, matlab returns an error:
nlinfit(xdata,ydata,fun,A)
Error in fun(line 13)
Not enough input arguments.
So apparently, the xdata and A do not end up like this:
fun(xdata,A)
Does anybody know how to fit a function that was not defined using a function handle?
Thanks in advance!
2 件のコメント
Image Analyst
2017 年 12 月 11 日
Please attach your data and tell us the model you wish to fit to it. In the meantime, I've attached 3 demos that perhaps can be adapted to your situation.
Steven C
2017 年 12 月 12 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!