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

    function p = designconstraint(c,p)
%DESIGNCONSTRAINT command-line design constraint properties
%
% p = designconstraint(c,p)

%  Copyright 2007 The MathWorks, Inc.

CLSID = mfilename('class');
[p,OK] = PersistentStore(p,CLSID);
if ~OK
    p = iMakeProps(c,p);
    PersistentStore(p,CLSID);
end


function p = iMakeProps(c,p)

nf = nFactors(c);
p = addprop(p,'CenterPoint',...
    @iGetXc,...
    @iSetXc,...
    'vector',nFactors(c),...
    'Center of ellipse');


p = addprop(p,'Matrix',...
    @iGetW,...
    @iSetW,...
    'matrix',[nf nf],...
    'Ellipsoid form matrix (positive semi-definite)');

function v = iGetXc(con)

v = con.xc;

function con = iSetXc(con,v)

if isnumeric(v) 
   con = setCenter(con, v); 
end

function v = iGetW(con)

v = con.W;

function con = iSetW(con,v)

if isnumeric(v) 
   con = setDistanceMatrix(con,v);
end