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

1 visualizzazione (ultimi 30 giorni)

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 22 Gen 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'.

Più risposte (0)

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by