필터 지우기
필터 지우기

Using Cftool can I change the default fit options

조회 수: 4 (최근 30일)
Liam
Liam 2016년 1월 13일
답변: Tushar Sinha 2016년 1월 15일
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

답변 (1개)

Tushar Sinha
Tushar Sinha 2016년 1월 15일
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

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by