www.gusucode.com > control 案例程序 matlab源码代码 > control/ExamineAndChangePropertiesOfAnExistingModelExample.m

    %% Examine and Change Properties of an Existing Model
%%
% Load an existing state-space (<docid:control_ref.f4-390421>) model.  
load(fullfile(matlabroot,'examples','control','PadeApproximation1.mat'),'sys')
sys
%%
% The display shows that |sys| is a state-space model, and includes some of
% the property values of |sys|.  To see all properties of |sys|, use
% the |get| command.
get(sys)
%%
% Use dot notation to access the values of particular properties.  For
% example, display the A matrix of |sys|.
Amat = sys.A
%%
% Dot notation also lets you change the value of individual model properties. 
sys.InputDelay = 4.2;
sys.InputName = 'thrust';
sys.OutputName = 'velocity';
%%
% When you must change multiple property values at the same time to
% preserve the validity of the model, such as changing the dimensions of
% the state-space matrices, you can use the <docid:control_ref.f4-387075>
% command. For example, create a 1-state state-space model, and then
% replace the matrices with new values representing a 2-state model.
sys2 = rss(1);
Anew = [-2, 1; 0.5 0];
Bnew = [1; -1];
Cnew = [0, -0.4];
set(sys2,'A',Anew,'B',Bnew,'C',Cnew)
sys2
%%
% Changing certain properties, such as |Ts| or |TimeUnit|,
% can cause undesirable changes in system behavior. See the property
% descriptions in the model reference pages for more information.