Using Cftool can I change the default fit options
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am using the cftool to repeatedly fit different data sets that are similar, using a custom equation. Once I have fitted a dataset I then want to keep the fit options and equation the same and load in the next dataset. Is there anyway to change the default fit options for a custom equation/ prevent the fit options being reset to the defaults of -Inf and Inf?
Thanks
0 commentaires
Réponses (1)
Tushar Sinha
le 15 Jan 2016
Hi Liam,
Once you have selected the "fitoptions", you can generate MATLAb code using the "File->Generate Code" in CF Tool GUI. Now, you can use this code to fit other datasets. The "fitoptions" will not change unless you change the code.
The generated code will look something like:
ft = fittype( 'poly1' );
opts = fitoptions( 'Method', 'LinearLeastSquares' );
opts.Lower = [-12 -Inf];
opts.Upper = [12 Inf];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
Now you can simple change "xData" and "yData" to fit new data without changing options.
I hope this helps you.
Thanks,
Tushar
0 commentaires
Voir également
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!