📄 simo.m
字号:
function [ret,x0,str]=simo(t,x,u,flag);
%SIMO is the M-file description of the SIMULINK system named SIMO.
% The block-diagram can be displayed by typing: SIMO.
%
% SYS=SIMO(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 SIMO 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 SIMO with a FLAG of zero:
% [SIZES]=SIMO([],[],[],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.
% Note: This M-file is only used for saving graphical information;
% after the model is loaded into memory an internal model
% representation is used.
% Copyright (c) 1990-94 by The MathWorks, Inc.
% 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',[0,0,390,193])
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/Scope',[sys,'/','Scope'])
set_param([sys,'/','Scope'],...
'Vgain','10.000000',...
'Hgain','20.000000',...
'Vmax','20.000000',...
'Hmax','40.000000',...
'Window',[100,100,380,320],...
'position',[275,135,300,165])
add_block('built-in/State-space',[sys,'/','State-space'])
set_param([sys,'/','State-space'],...
'A','[-0.3 0 0;2.9 -0.62,-2.3;0,2.3,0]',...
'B','[1;0;0]',...
'C','[1 1 0; 1 -3 1]',...
'D','[0;1]',...
'X0','[1;1;1]',...
'position',[130,38,215,82])
add_block('built-in/Inport',[sys,'/','Inport'])
set_param([sys,'/','Inport'],...
'Port','1',...
'position',[45,50,65,70])
add_block('built-in/Outport',[sys,'/','Outport'])
set_param([sys,'/','Outport'],...
'Port','1',...
'position',[310,15,330,35])
add_block('built-in/Outport',[sys,'/','Outport1'])
set_param([sys,'/','Outport1'],...
'Port','2',...
'position',[310,90,330,110])
add_block('built-in/Demux',[sys,'/','Demux'])
set_param([sys,'/','Demux'],...
'outputs','2',...
'position',[235,39,275,81])
add_line(sys,[70,60;125,60])
add_line(sys,[220,60;270,150])
add_line(sys,[220,60;230,60])
add_line(sys,[280,50;290,50;290,25;305,25])
add_line(sys,[280,70;290,70;290,100;305,100])
% Return any arguments.
if (nargin | nargout)
% Must use feval here to access system in memory
if (nargin > 3)
if (flag == 0)
eval(['[ret,x0,xstr]=',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 + -