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

    function [con, bp, ok] = findBoundaryPoints(con, opts, X)
%FINDBOUNDARYPOINTS Find the boundary points for a constraint
%
%  [CON, BP] = FINDBOUNDARYPOINTS(CON, OPTS, X)
%
%  This method needs to be overloaded for sub-classes that require boundary
%  points as part of the fitting process.
%
%  See also CONBASE, CONBASE/FINDSPECIALPOINTS, CONBASE/FITCONSTRAINT,
%    CONBASE/GETBOUNDARYPOINTOPTIONS. 

%  Copyright 2005-2007 The MathWorks, Inc.

Xc = pFilterFactors( con, X );

[a, ai] = min( Xc, [], 1 );
[b, bi] = max( Xc, [], 1 );

con.Center    = 0.5 * (b + a);
con.HalfWidth = 0.5 * (b - a);

md = max(constraintDistance(con,X));
if md>0
    con.HalfWidth  = con.HalfWidth + 2*md*con.ScaleFactor;
end


bp = unique( [ai; bi] );
ok = true;

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|