How do I provide a function or script name as the fitting model for the Curve Fitting Toolbox 1.1 (R13)?

1 Ansicht (letzte 30 Tage)

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 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'.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by