www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdev_local/ApplyOutliers.m

    function mdev= ApplyOutliers(mdev,SweepPos,ind)
%APPLYOUTLIERS changes outliers and refits model
%
%  mdev= ApplyOutliers(mdev,SweepPos,ind)

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

% update outliers
p= outliers(mdev,ind);
mdev= p.info;   

Lold= model(mdev);

% change to 0 iterations so covariance model is not updated
OldFitAlg= get(Lold,'fitalg');
set(Lold,'fitalg','ols')
mdev= model(mdev,Lold);

if ~isPointByPoint(mdev)
    % reinitialise model parameters but not for localmulti
    mdev.AllModels(:,SweepPos)=NaN;
end
% refit model 
[OK,mdev]= fitmodel(mdev,SweepPos);
% model might have been changed by FitModel
L= model(mdev);
set(L,'fitalg',OldFitAlg)
mdev= model(mdev,L);

pointer(mdev);