📄 resetint.m
字号:
function [ret,x0,str,ts,xts]=resetint(t,x,u,flag);
%RESETINT is the M-file description of the SIMULINK system named RESETINT.
% The block-diagram can be displayed by typing: RESETINT.
%
% SYS=RESETINT(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 RESETINT 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 RESETINT with a FLAG of zero:
% [SIZES]=RESETINT([],[],[],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.3)
if (0 == (nargin + nargout))
set_param(sys,'Location',[21,297,408,529])
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', '.1')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
% Subsystem ['Resettable',13,'integrator'].
new_system([sys,'/',['Resettable',13,'integrator']])
set_param([sys,'/',['Resettable',13,'integrator']],'Location',[232,509,633,687])
add_block('built-in/Switch',[sys,'/',['Resettable',13,'integrator/Switch']])
set_param([sys,'/',['Resettable',13,'integrator/Switch']],...
'Threshold','eps',...
'position',[200,29,225,61])
add_block('built-in/Reset integrator',[sys,'/',['Resettable',13,'integrator/Reset',13,'integrator']])
set_param([sys,'/',['Resettable',13,'integrator/Reset',13,'integrator']],...
'Initial','init',...
'position',[275,54,315,86])
add_block('built-in/Outport',[sys,'/',['Resettable',13,'integrator/out_1']])
set_param([sys,'/',['Resettable',13,'integrator/out_1']],...
'position',[345,60,365,80])
add_block('built-in/Inport',[sys,'/',['Resettable',13,'integrator/in_3']])
set_param([sys,'/',['Resettable',13,'integrator/in_3']],...
'Port','3',...
'position',[200,110,220,130])
add_block('built-in/Relational Operator',[sys,'/',['Resettable',13,'integrator/equal']])
set_param([sys,'/',['Resettable',13,'integrator/equal']],...
'Operator','==',...
'position',[140,69,170,91])
add_block('built-in/Inport',[sys,'/',['Resettable',13,'integrator/in_1']])
set_param([sys,'/',['Resettable',13,'integrator/in_1']],...
'position',[45,25,65,45])
add_block('built-in/Inport',[sys,'/',['Resettable',13,'integrator/in_2']])
set_param([sys,'/',['Resettable',13,'integrator/in_2']],...
'Port','2',...
'position',[45,95,65,115])
add_line([sys,'/',['Resettable',13,'integrator']],[70,105;250,105;250,70;270,70])
add_line([sys,'/',['Resettable',13,'integrator']],[115,105;115,75;135,75])
add_line([sys,'/',['Resettable',13,'integrator']],[175,80;175,45;195,45])
add_line([sys,'/',['Resettable',13,'integrator']],[320,70;340,70])
add_line([sys,'/',['Resettable',13,'integrator']],[225,120;260,120;270,80])
add_line([sys,'/',['Resettable',13,'integrator']],[70,35;195,35])
add_line([sys,'/',['Resettable',13,'integrator']],[230,45;250,45;250,60;270,60])
set_param([sys,'/',['Resettable',13,'integrator']],...
'Mask Display','Resettable\nintegrator',...
'Mask Type','Resettable integrator')
set_param([sys,'/',['Resettable',13,'integrator']],...
'Mask Dialogue','Integrates first input. If second input is not zero, integration stops and state is set to third input.|Initial value:',...
'Mask Translate','init = @1;')
set_param([sys,'/',['Resettable',13,'integrator']],...
'Mask Help','RESETTABLE INTEGRATOR The resettable integrator is a masked function. This block has same functionality as the built-in RESET INTEGRATOR except that when input 2 is non-zero, the block stops integration.')
set_param([sys,'/',['Resettable',13,'integrator']],...
'Mask Entries','15\/')
% Finished composite block ['Resettable',13,'integrator'].
set_param([sys,'/',['Resettable',13,'integrator']],...
'position',[135,22,210,78])
add_block('built-in/Note',[sys,'/',['NOTE: This block is different from the built-in Reset-integrator.',13,'When the second input is non-zero, this block resets state and',13,'stops integration, while the reset integrator reset state only. ']])
set_param([sys,'/',['NOTE: This block is different from the built-in Reset-integrator.',13,'When the second input is non-zero, this block resets state and',13,'stops integration, while the reset integrator reset state only. ']],...
'position',[190,110,195,115])
add_block('built-in/Note',[sys,'/',['T_(i+1) ',13,'INT U_1(t) dt',13,'T_i ']])
set_param([sys,'/',['T_(i+1) ',13,'INT U_1(t) dt',13,'T_i ']],...
'position',[170,180,175,185])
add_block('built-in/Note',[sys,'/',['The difference between the output of this block and the built-in',13,'Reset-integrator block is one step integration value, or, ']])
set_param([sys,'/',['The difference between the output of this block and the built-in',13,'Reset-integrator block is one step integration value, or, ']],...
'position',[190,150,195,155])
% 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
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -