资源简介
在原有离散数据的基础上,利用MATLAB中除非cftool命令弹出命令窗口,选择fitting命令,可选择函数或者自己设计函数形式
代码片段和文件信息
function [cf_gof] =createFit(tdata)
%CREATEFIT Create plot of datasets and fits
% CREATEFIT(TDATA)
% Creates a plot similar to the plot in the main curve fitting
% window using the data that you provide as input. You can
% apply this function to the same data you used with cftool
% or with different data. You may want to edit the function to
% customize the code and this help message.
%
% Number of datasets: 1
% Number of fits: 1
% Data from dataset “data vs. t“:
% X = t:
% Y = data:
% Unweighted
%
% This function was automatically generated on 04-Mar-2010 19:42:27
% Set up figure to receive datasets and fits
f_ = clf;
figure(f_);
set(f_‘Units‘‘Pixels‘‘Position‘[473 113 688 488]);
legh_ = []; legt_ = {}; % handles and text for legend
xlim_ = [Inf -Inf]; % limits of x axis
ax_ = axes;
set(ax_‘Units‘‘normalized‘‘OuterPosition‘[0 0 1 1]);
set(ax_‘Box‘‘on‘);
axes(ax_); hold on;
% --- Plot data originally in dataset “data vs. t“
t = t(:);
data = data(:);
h_ = line(tdata‘Parent‘ax_‘Color‘[0.333333 0 0.666667]...
‘Linestyle‘‘none‘ ‘LineWidth‘1...
‘Marker‘‘.‘ ‘MarkerSize‘12);
xlim_(1) = min(xlim_(1)min(t));
xlim_(2) = max(xlim_(2)max(t));
legh_(end+1) = h_;
legt_{end+1} = ‘data vs. t‘;
% Nudge axis limits beyond data limits
if all(isfinite(xlim_))
xlim_ = xlim_ + [-1 1] * 0.01 * diff(xlim_);
set(ax_‘XLim‘xlim_)
else
set(ax_ ‘XLim‘[3.5699999999999998 353.43000000000001]);
end
% --- Create fit “fit 1“
fo_ = fitoptions(‘method‘‘Non
- 上一篇:matlab一元线性回归
- 下一篇:循环自相关函数matlab程序
评论
共有 条评论