How do I provide a function or script name as the fitting model for the Curve Fitting Toolbox 1.1 (R13)?
4 views (last 30 days)
Show older comments
For example, for NLINFIT in the Statistics Toolbox, I can provide a function name as our fit model.
Accepted Answer
MathWorks Support Team
on 22 Jan 2010
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 Comments
More Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!