matlab 区块注释,大佬们问个题目,区块程序在下面。

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

function[fitresult,gof]=createFits(Var_time,Var_temp4)

%% Initialization.

%初始化数组以存储拟合和拟合优度

fitresult=cell(5,1);

gof=struct('sse',cell(5,1),...'rsquaare',[],'def',[],'adjrsquare',[],'rmse',[]);

%% Fit('untitled fit 1')

[xData,yData]= prepareCurveData(Var_time, Var_temp4);

% Set up fittype and options.

ft=fittype('exp2');

opts=fitoptions('Method','NonlinearLeastSquares');

opts.Display='Off';

opts.StartPoint = [48.0441877908425 -8.6230134147934e-11 -13.4553321771453 -0.00477574019349817];

% 适合数据模型

[fitresult{1},gof(1)]=fit(xData,yData,ft,opts);

% Plot fit with data.

figure('Name','untitled fit 1');

h=plot(fitreslt{1},xData,yData);

legend(h,'Var_temp4 vs. Var_time','untitled fit 1','location','NorthEest' );

% Label axes

xlabel Var_time

ylabel Var_temp4

grid on

%% Fit:'untitled fit 2'.

[xData,yData]=prepareCurvedata(Var_time,Var_temp4);

% Set up fittype and options.

ft=fittype('fourier4');

opts=fitoptions('Method','NonlinearLeastSquares');

opts.Display='Off';

opts.StartPoint=[0 0 0 0 0 0 0 0 0 0 .000290888208665722];

% Fit model to data.

[fitresult{2},gof(2)]=fit(xData,yData,ft,opts);

% Plot fit with data.

figure('Name','untitled fit 2');

h=piot(fitresult{2},xData,yData);

legend(h,'Var_temp4 vs. Var_time','untitled fit 2','Location','NorthEast');

% Label axes

xlabel Var_time

ylabel Var_temp4

grid on

%% Fit:'untitled fit 3'.

[xData,yData]=prepareCurveData(Var_time,Var_temp4);

% Set up fittype and options.

ft=fittype('gauss');

opts=fitoptions('Method','NonlinearLeastSquares');

opts.Display='Off';

opts.Lower=[-Inf -Inf 0 -Inf -Inf 0 -Inf -Inf 0 -Inf -Inf 0];

opts.StartPoint=[48.08 5400 10510.5884526692 8.10587938844389 648

253.241727316352 7.01606570893423 1144 240.099523117751

5.69096706629565 1603 271.393037821933];

% Fit model to data.

[fitrestult{3},gof(3)]=fit(xData,yData,ft,opts);

% Plot fit with data.

figure('Name','untitled fit 3');

h=piot(fitresult{3},xData,yData);

legen(h,'Var_temp4 vs. Var_time','untitled fit 3','Location','NorthEast

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值