www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregusermod/evalConstraints.m

    function g= evalConstraints(U,val,varargin)
%EVALCONSTRAINTS evaluate all parameter constraints
%
% g= evalConstraints(U,b0);
%  all(g<=0) if feasible
% this is intended for determining if the parameters b0 are feasible at 
% bounds and linear constraints are included in the calculation

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



[LB,UB,A,b,nl]=constraints(U);

g= [];
if ~isempty(LB)
    LB = LB(:);
    g= [g;LB-val];
end

if ~isempty(UB)
    UB = UB(:);
    g= [g;val-UB];
end

if ~isempty(A)
   g= [g;A*val-b];
end

if nl>0
   g= [g; nlconstraints(val,U,varargin{:})];
end