📄 ungerboe.m
字号:
function [ret,x0,str,ts,xts]=ungerboe(t,x,u,flag);
%UNGERBOE is the M-file description of the SIMULINK system named UNGERBOE.
% The block-diagram can be displayed by typing: UNGERBOE.
%
% SYS=UNGERBOE(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 UNGERBOE 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 UNGERBOE with a FLAG of zero:
% [SIZES]=UNGERBOE([],[],[],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',[110,42,581,172])
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/Inport',[sys,'/','In1'])
set_param([sys,'/','In1'],...
'position',[35,35,55,55])
add_block('built-in/Outport',[sys,'/','Out1'])
set_param([sys,'/','Out1'],...
'position',[425,30,445,50])
add_block('built-in/Outport',[sys,'/','Out2'])
set_param([sys,'/','Out2'],...
'Port','2',...
'position',[425,80,445,100])
add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator']])
set_param([sys,'/',['Logical',13,'Operator']],...
'ForeGround',4,...
'hide name',0,...
'Operator','XOR',...
'position',[320,22,365,53])
add_block('built-in/Memory',[sys,'/','Memory'])
set_param([sys,'/','Memory'],...
'ForeGround',2,...
'hide name',0,...
'position',[215,30,255,60])
add_block('built-in/Memory',[sys,'/','Memory1'])
set_param([sys,'/','Memory1'],...
'ForeGround',2,...
'hide name',0,...
'position',[115,30,155,60])
add_line(sys,[60,45;110,45])
add_line(sys,[160,45;210,45])
add_line(sys,[260,45;315,45])
add_line(sys,[75,45;75,20;290,20;290,30;315,30])
add_line(sys,[370,40;420,40])
add_line(sys,[180,45;180,90;420,90])
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 + -