www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregMdlGui/@boxcox/drawResiduals.m

    function drawResiduals(h)
%DRAWRESIDUALS Update the residuals graph
%
%  DRAWRESIDUALS(OBJ) updates the data in the top model information plot.

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


% Get model, X,Y data, lambda and graph2d to plot on
graph2d = h.Graph2d;
p = h.ptrMdev;
m = p.model;
X = p.getdata('X');
Y = p.getdata('Y');
lambda = h.Lambda;

% Apply the current transformation to a copy of model
if lambda == 1
   m = set(m,'ytrans','');
else
   m = set(m,'boxcox',{lambda,double(Y)});
end
m = set(m,'fitalg','leastsq');
m = fitmodel(m,X,Y);

% Get the model statistics ...
[data,factors,standardPlotStr,olIndex] = diagnosticStats(m,X,Y);

% and plot on the graph2d object
set(graph2d,'data',data,...
   'factors',factors,...
   'limits',repmat({'auto'},1,size(data,2)));