求教cftool导出的代码如何使用?
Afficher commentaires plus anciens
这是从cftool导出的代码,执行后提示“输入参数的数目不足”。
function [fitresult, gof] = createFit(t1, C41)
%CREATEFIT(T1,C41)
% Create a fit.
%
% Data for 'A1' fit:
% X Input : t1
% Y Output: C41
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% 另请参阅 FIT, CFIT, SFIT.
% 由 MATLAB 于 06-Aug-2022 09:17:52 自动生成
%% Fit: 'A1'.
[xData, yData] = prepareCurveData( t1, C41 );
% Set up fittype and options.
ft = fittype( 'poly2' );
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft );
% Plot fit with data.
figure( 'Name', 'A1' );
h = plot( fitresult, xData, yData );
legend( h, 'C41 vs. t1', 'A1', 'Location', 'NorthEast', 'Interpreter', 'none' );
% Label axes
xlabel( 't1', 'Interpreter', 'none' );
ylabel( 'C41', 'Interpreter', 'none' );
grid off

代码,数据已上传附件,求大佬帮忙解答。
cftool session拟合结果由于不支持sfit格式文件上传,采用压缩包。
Réponses (2)
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!