📄 rctdm.m
字号:
function [ret,x0,str,ts,xts]=rctdm(t,x,u,flag);
%RCTDM is the M-file description of the SIMULINK system named RCTDM.
% The block-diagram can be displayed by typing: RCTDM.
%
% SYS=RCTDM(T,X,U,FLAG) returns depending on FLAG certain
% system values given time point, T, current state vector, X,
% and input vector, U.
% FLAG is used to indicate the type of output to be returned in SYS.
%
% Setting FLAG=1 causes RCTDM to return state derivatives, FLAG=2
% discrete states, FLAG=3 system outputs and FLAG=4 next sample
% time. For more information and other options see SFUNC.
%
% Calling RCTDM with a FLAG of zero:
% [SIZES]=RCTDM([],[],[],0), returns a vector, SIZES, which
% contains the sizes of the state vector and other parameters.
% SIZES(1) number of states
% SIZES(2) number of discrete states
% SIZES(3) number of outputs
% SIZES(4) number of inputs
% SIZES(5) number of roots (currently unsupported)
% SIZES(6) direct feedthrough flag
% SIZES(7) number of sample times
%
% For the definition of other parameters in SIZES, see SFUNC.
% See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.
% Note: This M-file is only used for saving graphical information;
% after the model is loaded into memory an internal model
% representation is used.
% the system will take on the name of this mfile:
sys = mfilename;
new_system(sys)
simver(1.3)
if (0 == (nargin + nargout))
set_param(sys,'Location',[43,410,237,829])
open_system(sys)
end;
set_param(sys,'algorithm', 'RK-45')
set_param(sys,'Start time', '0.0')
set_param(sys,'Stop time', '999999')
set_param(sys,'Min step size', '0.0001')
set_param(sys,'Max step size', '10')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
add_block('built-in/Note',[sys,'/','Robust Control Toolbox Demos'])
set_param([sys,'/','Robust Control Toolbox Demos'],...
'position',[100,31,105,36])
% Subsystem ['LQG//LTR Controller',13,'Design'].
new_system([sys,'/',['LQG//LTR Controller',13,'Design']])
set_param([sys,'/',['LQG//LTR Controller',13,'Design']],'Location',[-10,380,117,533])
set_param([sys,'/',['LQG//LTR Controller',13,'Design']],...
'Mask Display','LTR\nDemo1',...
'Mask Dialogue','eval(''if ~exist(''''ltry''''), fprintf(''''\nMust be licensed for RCT toolbox\n''''), else ltrdata1; ltrdemo1; end;'')')
% Finished composite block ['LQG//LTR Controller',13,'Design'].
set_param([sys,'/',['LQG//LTR Controller',13,'Design']],...
'position',[65,64,116,107])
% Subsystem ['LQG//LTR Controller ',13,'Design',13,'a more complex case'].
new_system([sys,'/',['LQG//LTR Controller ',13,'Design',13,'a more complex case']])
set_param([sys,'/',['LQG//LTR Controller ',13,'Design',13,'a more complex case']],'Location',[-10,380,117,533])
set_param([sys,'/',['LQG//LTR Controller ',13,'Design',13,'a more complex case']],...
'Mask Display','LTR\nDemo2')
set_param([sys,'/',['LQG//LTR Controller ',13,'Design',13,'a more complex case']],...
'Mask Dialogue','eval(''if ~exist(''''ltry''''), fprintf(''''\nMust be licensed for RCT toolbox\n''''), else ltrdata2; ltrdemo2; end;'')')
% Finished composite block ['LQG//LTR Controller ',13,'Design',13,'a more complex case'].
set_param([sys,'/',['LQG//LTR Controller ',13,'Design',13,'a more complex case']],...
'position',[65,140,116,183])
% Subsystem ['H_2 Controller ',13,'Design'].
new_system([sys,'/',['H_2 Controller ',13,'Design']])
set_param([sys,'/',['H_2 Controller ',13,'Design']],'Location',[-10,380,117,533])
set_param([sys,'/',['H_2 Controller ',13,'Design']],...
'Mask Display','H_2\nDemo',...
'Mask Dialogue','eval(''if ~exist(''''musyn''''), fprintf(''''\nMust be licensed for RCT toolbox\n''''), else h2data; h2demo1; end;'')')
% Finished composite block ['H_2 Controller ',13,'Design'].
set_param([sys,'/',['H_2 Controller ',13,'Design']],...
'position',[65,235,116,278])
% Subsystem ['H_infinity Controller',13,'Design'].
new_system([sys,'/',['H_infinity Controller',13,'Design']])
set_param([sys,'/',['H_infinity Controller',13,'Design']],'Location',[-10,380,117,533])
set_param([sys,'/',['H_infinity Controller',13,'Design']],...
'Mask Display','H_infty\nDemo',...
'Mask Dialogue','eval(''if ~exist(''''musyn''''), fprintf(''''\nMust be licensed for RCT toolbox\n''''), else hinfdata; hinfdm; end;'')')
% Finished composite block ['H_infinity Controller',13,'Design'].
set_param([sys,'/',['H_infinity Controller',13,'Design']],...
'position',[65,320,116,363])
drawnow
% Return any arguments.
if (nargin | nargout)
% Must use feval here to access system in memory
if (nargin > 3)
if (flag == 0)
eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
else
eval(['ret =', sys,'(t,x,u,flag);'])
end
else
[ret,x0,str,ts,xts] = feval(sys);
end
else
drawnow % Flash up the model and execute load callback
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -