資源簡(jiǎn)介
在原有離散數(shù)據(jù)的基礎(chǔ)上,利用MATLAB中除非cftool命令彈出命令窗口,選擇fitting命令,可選擇函數(shù)或者自己設(shè)計(jì)函數(shù)形式
代碼片段和文件信息
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‘a(chǎn)x_‘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
評(píng)論
共有 條評(píng)論