www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@contable1/constraintDistance.m
function d = constraintDistance(c, X) %CONSTRAINTDISTANCE Signed distance to constraint boundary for a list of points % % D = CONSTRAINTDISTANCE(CON, X) is the signed distance to the boundary of % the constraint CON for the list of points X. This method constitutes the % core definition of the constraint in terms of what is in and what is % out. % % X should be an array with nFactors( CON ) columns. D will be a vector % with the same number of rows as X. % % See also CONTABLE1, CONBASE/CONSTRAINTDISTANCE, CONTABLE1/ISINSIDE. % Copyright 2000-2005 The MathWorks, Inc. DIST_MODE = 2; d = xreginterp1d( c.breakcols, c.table, getActiveIndices( c ), c.le, X, DIST_MODE); % Need to take into account the scale of the response, i.e., the y-axis % or second active factor cif = getActiveFactors( c ); sc = 0.5 * (getMax( cif(2) ) - getMin( cif(2) )); d = d/sc; %------------------------------------------------------------------------------| % EOF %------------------------------------------------------------------------------|