www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conellipsoid/conellipsoid.m
function con = conellipsoid(cif) %CONELLIPSOID Ellipsoid constraint object % % OBJ=CONELLIPSOID(CIF) % % CONELLIPSOID objects constrain points according to the equation % (x-xc)'*W*(x-xc) <= 1 % % See also CONBASE, CONINPUTFACTOR. % Copyright 2000-2008 The MathWorks, Inc. and Ford Global Technologies, Inc. % Version history for CONELLIPSOID structure % % Version 1: % xc % W % % Version 2: % scalefactor % % Version 3: % c.xc=zeros(1,sz); % c.W=eye(sz); % c.version = 3; % c.scalefactor = 1; % controls interior/exterior setting % parent = conbase( sz ); % % Version 4 % Change of con-object structure % Version 5 % Add offset to account for rounding if ~nargin cif = coninputfactor( 2 ); end if isstruct( cif ) parent = cif.conbase; con = mv_rmfield( cif, 'conbase' ); else [con.xc, con.W] = i_defaultCenterAndMatrix( cif.Min, cif.Max ); con.version = 5; con.scalefactor = 1; % controls interior/exterior setting con.Offset = 0; parent = conbase( cif ); end con = class( con, 'conellipsoid', parent ); %-------------------------------------------------------------------------- function [xc, W] = i_defaultCenterAndMatrix( mn, mx ) % mn, mx are the min and max of the range for each input factor % By default, choose the center of the range xc = 0.5 * (mx + mn); % W must be positive semi-definite % By default, choose the ellipse to touch the center of each face of the % bounding box W = diag( 1./(0.5 * (mx - mn)).^2 ); %-------------------------------------------------------------------------- % EOF %--------------------------------------------------------------------------