⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oil.m

📁 本程序是用matlable求任意一个二维矩阵的边界矩阵
💻 M
字号:
function oil(x,y)%OIL    Create plot of datasets and fits%   OIL(X,Y)%   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:  2 % Data from dataset "y vs. x":%    X = x:%    Y = y:%    Unweighted%% This function was automatically generated% Set up figure to receive datasets and fitsf_ = clf;figure(f_);legh_ = []; legt_ = {};   % handles and text for legendxlim_ = [Inf -Inf];       % limits of x axisax_ = subplot(1,1,1);set(ax_,'Box','on');axes(ax_); hold on;x=[1970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003];y=[46808494165309457237566775619859673618266415865220631086094459543587795982260087618256310464963660926644367061672736737268679699557152273292739327582676954781057843979813];% --- Plot data originally in dataset "y vs. x"x = x(:);y = y(:);h_ = line(x,y,'Parent',ax_,'Color',[0.333333 0 0.666667],...     'LineStyle','none', 'LineWidth',1,...     'Marker','.', 'MarkerSize',12);xlim_(1) = min(xlim_(1),min(x));xlim_(2) = max(xlim_(2),max(x));legh_(end+1) = h_;legt_{end+1} = 'y vs. x';% Nudge axis limits beyond data limitsif all(isfinite(xlim_))   xlim_ = xlim_ + [-1 1] * 0.01 * diff(xlim_);   set(ax_,'XLim',xlim_)end% --- Create fit "fit 1"st_ = [31950 556 1.605 -3159 4e-006 0.02366 ];ft_ = fittype('a1+a2*cos(a3*x+a4)+a5*exp(a6*x)' ,...     'dependent',{'y'},'independent',{'x'},...     'coefficients',{'a1', 'a2', 'a3', 'a4', 'a5', 'a6'});% Fit this model using new datacf_ = fit(x,y,ft_ ,'Startpoint',st_);% Or use coefficients from the original fit:if 0   cv_ = {31950, 556, 1.604999972619, -3159, 1.238523818602e-016, 0.02365999999998};   cf_ = cfit(ft_,cv_{:});end% Plot this fith_ = plot(cf_,'fit',0.95);legend off;  % turn off legend from plot method callset(h_(1),'Color',[1 0 0],...     'LineStyle','-', 'LineWidth',2,...     'Marker','none', 'MarkerSize',6);legh_(end+1) = h_(1);legt_{end+1} = 'fit 1';% --- Create fit "fit 1 copy 1"st_ = [31950 556 1.605 -3159 4e-006 0.02366 ];ft_ = fittype('a1+a2*cos(a3*x+a4)+a5*exp(a6*x)' ,...     'dependent',{'y'},'independent',{'x'},...     'coefficients',{'a1', 'a2', 'a3', 'a4', 'a5', 'a6'});% Fit this model using new datacf_ = fit(x,y,ft_ ,'Startpoint',st_);% Or use coefficients from the original fit:if 0   cv_ = {31950, 556, 1.604999972619, -3159, 1.238523818602e-016, 0.02365999999998};   cf_ = cfit(ft_,cv_{:});end% Plot this fith_ = plot(cf_,'fit',0.95);legend off;  % turn off legend from plot method callset(h_(1),'Color',[0 0 1],...     'LineStyle','-', 'LineWidth',2,...     'Marker','none', 'MarkerSize',6);legh_(end+1) = h_(1);legt_{end+1} = 'fit 1 copy 1';hold off;legend(ax_,legh_, legt_);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -