📄 simlinq1.m
字号:
function [ret,x0,str]=simlinq1(t,x,u,flag);
%SIMLINQ1 is the M-file description of the SIMULINK system named SIMLINQ1.
% The block-diagram can be displayed by typing: SIMLINQ1.
%
% SYS=SIMLINQ1(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 SIMLINQ1 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 SIMLINQ1 with a FLAG of zero:
% [SIZES]=SIMLINQ1([],[],[],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.
% the system will take on the name of this mfile:
sys = mfilename;
new_system(sys)
simver(1.2)
if(0 == (nargin + nargout))
set_param(sys,'Location',[208,245,596,426])
open_system(sys)
end;
set_param(sys,'algorithm', 'RK-45')
set_param(sys,'Start time', '0.0')
set_param(sys,'Stop time', '1')
set_param(sys,'Min step size', '0.05')
set_param(sys,'Max step size', '0.05')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
'position',[110,65,130,85])
add_block('built-in/Integrator',[sys,'/','Integrator'])
set_param([sys,'/','Integrator'],...
'Initial','100',...
'position',[180,65,200,85])
add_block('built-in/Inport',[sys,'/','Inport'])
set_param([sys,'/','Inport'],...
'position',[25,70,45,90])
add_line(sys,[135,75;170,75])
add_line(sys,[205,75;205,40;90,40;90,70;100,70])
add_line(sys,[50,80;100,80])
% 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 + -