求教cftool导出的代码如何使用?
12 views (last 30 days)
Show older comments
这是从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格式文件上传,采用压缩包。
0 Comments
Answers (2)
DR
on 18 Oct 2023
这个是单独的函数,需要调用的,你先把这个文件保存在一个文件夹里,然后在创建一个m文件放在同一个文件夹,进入m文件,调用这个函数p=createFit(t1, C41),在这函数上面加你的数据,t1=[...],C41=[...],数据自己填,然后直接运行就行
0 Comments
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!