www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conbase/getFitOptions.m

    function [opts,ok] = getFitOptions(con,action)
%GETFITOPTIONS fit options optimmgr boundary model
%
% [opts,ok] = getFitOptions(bdev,action);

%  Copyright 2008 The MathWorks, Inc. and Ford Global Technologies, Inc.

if nargin<2
    action = 'all';
end

action = lower( action );
doAll            = isequal( action, 'all' );
doSpecialPoints  = doAll || strcmp( action, 'specialpoints' );
doBoundaryPoints = doAll || strcmp( action, 'boundarypoints' );
doFitConstraint  = doAll || strcmp( action, 'constraint' );


spo = getspecialpointoptions( con );
bpo = getBoundaryPointOptions( con );
cfo = getConstraintFitOptions( con );


if isempty( spo ) && isempty( bpo ) && isempty( cfo ),
    % There are no fit options
   opts = [];
elseif doAll,
    % Use an "optimisation manager" to handle all the options
    opts = contextimplementation( xregoptmgr, con, '', '', 'Constraint Fitting', @getAllFitOptions );
    opts = AddOption( opts, 'SpecialPointOptions',  spo, class( spo ), 'Special Points',  ~isempty( spo ) );
    opts = AddOption( opts, 'BoundaryPointOptions', bpo, class( bpo ), 'Boundary Points', ~isempty( bpo ) );
    opts = AddOption( opts, 'ConstraintFitOptions', cfo, class( cfo ), 'Constraint Fit',  ~isempty( cfo ) );
elseif doSpecialPoints
    opts = spo;
elseif doBoundaryPoints
    opts = bpo;
elseif doFitConstraint
    opts = cfo;
end

ok = isempty(opts);
end