Borrar filtros
Borrar filtros

Using Cftool can I change the default fit options

3 visualizaciones (últimos 30 días)
Liam
Liam el 13 de En. de 2016
Respondida: Tushar Sinha el 15 de En. de 2016
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

Respuestas (1)

Tushar Sinha
Tushar Sinha el 15 de En. de 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

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by