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

    function [bdev, ok] = fitConstraint(bdev, action)
%FITCONSTRAINT Fit the constraint contained in this development node
%
%  [BDEV, OK] = FITCONSTRAINT(BDEV, ACTION)
%  [BDEV, OK] = FITCONSTRAINT(BDEV, 'All')
%  [BDEV, OK] = FITCONSTRAINT(BDEV, 'SpecialPoints')
%  [BDEV, OK] = FITCONSTRAINT(BDEV, 'BoundaryPoints')
%  [BDEV, OK] = FITCONSTRAINT(BDEV, 'Constraint')
%
%  The various constraint fitting options must be initialized before
%  calling this method.
%
%  See also XREGBDRYDEV, 
%           XREGBDRYDEV/GUISETFITOPTIONS,
%           CONBASE/FINDSPECIALPOINTS,
%           CONBASE/FINDBOUNDARYPOINTS,
%           CONBASE/FITCONSTRAINT.

%  Copyright 2005-2009 The MathWorks, Inc. and Ford Global Technologies, Inc.
        
% Get data for fitting constraint to
X = getFitData( bdev );
% Constraint
con = bdev.Constraint;

if ~isempty(con)
    % Fit constraint
    sp = bdev.SpecialPoints;
    bp = bdev.BoundaryPoints;
    opts = getFitOptions(bdev,action);
    
    [con,ok,sp,bp,fitstatus] = fit(con,action,opts,X,sp,bp);
    
    if ok,
        bdev = setFitOptions(bdev,action,opts);
        bdev = StoreStatus(bdev,con,fitstatus,sp,bp);
    end
else
    ok = false;
end
%--------------------------------------------------------------------------
% EOF
%--------------------------------------------------------------------------