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

    function [A, b] = getLinearForm(con)
%GETLINEARFORM Get the linear form of a constraint
%
%  [A, B] = GETLINEARFORM(CON)
%
%  The linear form of a constraint, CON, is a matrix, A, and a vector, B, such
%  that  
%              constraintDistance( CON, X ) = A * X - B,
% 
%  i.e., the constraint is given by A * X <= B.
%
%  The range constraint is given by a(i) <= X(i) <= b(i), i.e.,
%                     X(i) <=  b(i)
%           and      -X(i) <= -a(i)
%
%  See also CONRANGE, CONBASE/GETLINEARFORM.

%  Copyright 2000-2005 The MathWorks, Inc.

ai = getActiveIndices( con );

A = eye( nFactors( con ) );
A = A(ai,:);
A = [A; -A]; 

b = [con.Center + con.HalfWidth, con.HalfWidth - con.Center]';

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