How do I provide a function or script name as the fitting model for the Curve Fitting Toolbox 1.1 (R13)?
1 次查看(过去 30 天)
显示 更早的评论
For example, for NLINFIT in the Statistics Toolbox, I can provide a function name as our fit model.
采纳的回答
MathWorks Support Team
2010-1-22
If you use the custom equation option in CFTOOL, you can specify a function name which takes xdata and some parameters for fitting. You should write your function in the following form:
function y = custq(a,b,c,x)
y = a*x.^2 + b*x + c
Then from the command prompt, use the following commands:
f = fittype('custq(a,b,c,x)');
fo = fit(xdata,ydata,f);
OR, in the CFTOOL GUI you can put
custq(a,b,c,x)
in the custom equation field.
You have to specify the parameters along with the function name, and the coefficients you are looking for need to be scalar. Only the xdata "x" may be a vector. Also, make sure that the function accepts a vector 'x'.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File 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!