📄 lqgdemos.m
字号:
function [ret,x0,str]=lqgdemos(t,x,u,flag);
%LQGDEMOS is the M-file description of the SIMULINK system named LQGDEMOS.
% The block-diagram can be displayed by typing: LQGDEMOS.
%
% SYS=LQGDEMOS(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 LQGDEMOS 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 LQGDEMOS with a FLAG of zero:
% [SIZES]=LQGDEMOS([],[],[],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.
% For the definition of other parameters in SIZES, see SFUNC.
% See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.
% Copyright (c) 1990-94 by The MathWorks, Inc.
% 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',[50,59,515,352])
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', '')
% Subsystem ['Double click',13,'on this for demo.'].
new_system([sys,'/',['Double click',13,'on this for demo.']])
set_param([sys,'/',['Double click',13,'on this for demo.']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.']],...
'Mask Display','LQG\nDemo1',...
'Mask Type','',...
'Mask Dialogue','eval(''lqgdemo1'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click',13,'on this for demo.'].
set_param([sys,'/',['Double click',13,'on this for demo.']],...
'hide name',0,...
'position',[25,104,76,147])
% Subsystem ['Double click',13,'on this for demo.1'].
new_system([sys,'/',['Double click',13,'on this for demo.1']])
set_param([sys,'/',['Double click',13,'on this for demo.1']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.1']],...
'Mask Display','LQG\nDemo2',...
'Mask Type','',...
'Mask Dialogue','eval(''lqgdemo2'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click',13,'on this for demo.1'].
set_param([sys,'/',['Double click',13,'on this for demo.1']],...
'hide name',0,...
'position',[95,104,146,147])
% Subsystem ['Double click',13,'on this for demo.2'].
new_system([sys,'/',['Double click',13,'on this for demo.2']])
set_param([sys,'/',['Double click',13,'on this for demo.2']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.2']],...
'Mask Display','LQG\nDemo3',...
'Mask Type','',...
'Mask Dialogue','eval(''lqgdemo3'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click',13,'on this for demo.2'].
set_param([sys,'/',['Double click',13,'on this for demo.2']],...
'hide name',0,...
'position',[170,104,221,147])
% Subsystem ['Double click',13,'on this for demo.3'].
new_system([sys,'/',['Double click',13,'on this for demo.3']])
set_param([sys,'/',['Double click',13,'on this for demo.3']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.3']],...
'Mask Display','LQG\nDemo4',...
'Mask Type','',...
'Mask Dialogue','eval(''lqgdemo4'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click',13,'on this for demo.3'].
set_param([sys,'/',['Double click',13,'on this for demo.3']],...
'hide name',0,...
'position',[245,104,296,147])
% Subsystem ['Double click',13,'on this for demo.4'].
new_system([sys,'/',['Double click',13,'on this for demo.4']])
set_param([sys,'/',['Double click',13,'on this for demo.4']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.4']],...
'Mask Display','LQG\nDemo5',...
'Mask Type','',...
'Mask Dialogue','eval(''lqgdemo5'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click',13,'on this for demo.4'].
set_param([sys,'/',['Double click',13,'on this for demo.4']],...
'hide name',0,...
'position',[320,104,371,147])
% Subsystem ['Double click',13,'on this for demo.5'].
new_system([sys,'/',['Double click',13,'on this for demo.5']])
set_param([sys,'/',['Double click',13,'on this for demo.5']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.5']],...
'Mask Display','Load\ndata',...
'Mask Type','',...
'Mask Dialogue','eval(''lqgdata'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click',13,'on this for demo.5'].
set_param([sys,'/',['Double click',13,'on this for demo.5']],...
'hide name',0,...
'position',[25,214,96,250])
% Subsystem ['Double click',13,'on this for demo.6'].
new_system([sys,'/',['Double click',13,'on this for demo.6']])
set_param([sys,'/',['Double click',13,'on this for demo.6']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.6']],...
'Mask Display','Optimize\nDemo1',...
'Mask Type','',...
'Mask Dialogue','eval(''lqgopt'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click',13,'on this for demo.6'].
set_param([sys,'/',['Double click',13,'on this for demo.6']],...
'hide name',0,...
'position',[25,159,79,202])
add_block('built-in/Note',[sys,'/',['LQG Double click on these bocks to get increasingingly complex',13,'demos in the use of continuous LQG controllers.']])
set_param([sys,'/',['LQG Double click on these bocks to get increasingingly complex',13,'demos in the use of continuous LQG controllers.']],...
'position',[235,35,236,36])
% Subsystem ['Double click',13,'on this for demo.7'].
new_system([sys,'/',['Double click',13,'on this for demo.7']])
set_param([sys,'/',['Double click',13,'on this for demo.7']],'Location',[-10,380,117,533])
set_param([sys,'/',['Double click',13,'on this for demo.7']],...
'Mask Display','LQG\nDemo6',...
'Mask Type','',...
'Mask Dialogue','eval(''lqgdemo6'')',...
'Mask Translate','',...
'Mask Help','')
% Finished composite block ['Double click',13,'on this for demo.7'].
set_param([sys,'/',['Double click',13,'on this for demo.7']],...
'hide name',0,...
'position',[390,104,441,147])
add_block('built-in/Note',[sys,'/','Note: These demos require the Control System Toolbox'])
set_param([sys,'/','Note: These demos require the Control System Toolbox'],...
'position',[235,265,236,266])
% 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]=',sys,'(t,x,u,flag);'])
else
eval(['ret =', sys,'(t,x,u,flag);'])
end
else
[ret,x0,str] = feval(sys);
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -