📄 tstenv.m
字号:
function [ret,x0,str,ts,xts]=tstenv(t,x,u,flag);
%TSTENV is the M-file description of the SIMULINK system named TSTENV.
% The block-diagram can be displayed by typing: TSTENV.
%
% SYS=TSTENV(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 TSTENV 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 TSTENV with a FLAG of zero:
% [SIZES]=TSTENV([],[],[],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',[212,428,775,683])
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', '.010')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
% Subsystem ['Envelop',13,'Detector2'].
new_system([sys,'/',['Envelop',13,'Detector2']])
set_param([sys,'/',['Envelop',13,'Detector2']],'Location',[86,374,774,617])
add_block('built-in/Gain',[sys,'/',['Envelop',13,'Detector2/Gain1']])
set_param([sys,'/',['Envelop',13,'Detector2/Gain1']],...
'Gain','g',...
'position',[585,100,605,120])
add_block('built-in/Outport',[sys,'/',['Envelop',13,'Detector2/out_1']])
set_param([sys,'/',['Envelop',13,'Detector2/out_1']],...
'position',[625,100,645,120])
add_block('built-in/Gain',[sys,'/',['Envelop',13,'Detector2/Gain']])
set_param([sys,'/',['Envelop',13,'Detector2/Gain']],...
'Gain','g',...
'position',[65,100,85,120])
add_block('built-in/Inport',[sys,'/',['Envelop',13,'Detector2/in_1']])
set_param([sys,'/',['Envelop',13,'Detector2/in_1']],...
'position',[15,100,35,120])
add_block('built-in/Switch',[sys,'/',['Envelop',13,'Detector2/Switch']])
set_param([sys,'/',['Envelop',13,'Detector2/Switch']],...
'Threshold','eps',...
'position',[505,94,530,126])
add_block('built-in/Memory',[sys,'/',['Envelop',13,'Detector2/Memory']])
set_param([sys,'/',['Envelop',13,'Detector2/Memory']],...
'position',[140,35,180,65])
add_block('built-in/Memory',[sys,'/',['Envelop',13,'Detector2/Memory2']])
set_param([sys,'/',['Envelop',13,'Detector2/Memory2']],...
'orientation',2,...
'position',[495,155,535,185])
add_block('built-in/Relational Operator',[sys,'/',['Envelop',13,'Detector2/Relational',13,'Operator1']])
set_param([sys,'/',['Envelop',13,'Detector2/Relational',13,'Operator1']],...
'Operator','>',...
'position',[385,98,415,122])
add_block('built-in/Memory',[sys,'/',['Envelop',13,'Detector2/Memory1']])
set_param([sys,'/',['Envelop',13,'Detector2/Memory1']],...
'position',[300,125,340,155])
add_block('built-in/Relational Operator',[sys,'/',['Envelop',13,'Detector2/Relational',13,'Operator']])
set_param([sys,'/',['Envelop',13,'Detector2/Relational',13,'Operator']],...
'position',[225,93,255,117])
add_line([sys,'/',['Envelop',13,'Detector2']],[610,110;620,110])
add_line([sys,'/',['Envelop',13,'Detector2']],[535,110;560,110;560,170;540,170])
add_line([sys,'/',['Envelop',13,'Detector2']],[560,110;580,110])
add_line([sys,'/',['Envelop',13,'Detector2']],[90,110;105,110;105,50;135,50])
add_line([sys,'/',['Envelop',13,'Detector2']],[105,110;220,110])
add_line([sys,'/',['Envelop',13,'Detector2']],[40,110;60,110])
add_line([sys,'/',['Envelop',13,'Detector2']],[490,170;480,170;480,120;500,120])
add_line([sys,'/',['Envelop',13,'Detector2']],[420,110;500,110])
add_line([sys,'/',['Envelop',13,'Detector2']],[260,105;270,105;270,140;295,140])
add_line([sys,'/',['Envelop',13,'Detector2']],[270,105;380,105])
add_line([sys,'/',['Envelop',13,'Detector2']],[345,140;355,140;355,115;380,115])
add_line([sys,'/',['Envelop',13,'Detector2']],[185,50;195,50;195,100;220,100])
add_line([sys,'/',['Envelop',13,'Detector2']],[195,50;490,50;500,100])
set_param([sys,'/',['Envelop',13,'Detector2']],...
'Mask Display','Envelop\nDetector',...
'Mask Type','Envelop Detector',...
'Mask Dialogue','Envelop Detector:|Boundary Side (''upper'' or ''lower''):')
set_param([sys,'/',['Envelop',13,'Detector2']],...
'Mask Translate','x=@1;if length(x)<2, error(''Error in Envelop Detector''); end; x=x(1:2); g=1; if x==''lo'', g=-1; end;',...
'Mask Help','Envelop Detector detects the envelop of a signal.')
set_param([sys,'/',['Envelop',13,'Detector2']],...
'Mask Entries','''upper''\/')
% Finished composite block ['Envelop',13,'Detector2'].
set_param([sys,'/',['Envelop',13,'Detector2']],...
'ForeGround',3,...
'position',[235,44,295,96])
% Subsystem ['Envelop',13,'Detector1'].
new_system([sys,'/',['Envelop',13,'Detector1']])
set_param([sys,'/',['Envelop',13,'Detector1']],'Location',[86,374,774,617])
add_block('built-in/Relational Operator',[sys,'/',['Envelop',13,'Detector1/Relational',13,'Operator']])
set_param([sys,'/',['Envelop',13,'Detector1/Relational',13,'Operator']],...
'position',[225,93,255,117])
add_block('built-in/Memory',[sys,'/',['Envelop',13,'Detector1/Memory1']])
set_param([sys,'/',['Envelop',13,'Detector1/Memory1']],...
'position',[300,125,340,155])
add_block('built-in/Relational Operator',[sys,'/',['Envelop',13,'Detector1/Relational',13,'Operator1']])
set_param([sys,'/',['Envelop',13,'Detector1/Relational',13,'Operator1']],...
'Operator','>',...
'position',[385,98,415,122])
add_block('built-in/Memory',[sys,'/',['Envelop',13,'Detector1/Memory2']])
set_param([sys,'/',['Envelop',13,'Detector1/Memory2']],...
'orientation',2,...
'position',[495,155,535,185])
add_block('built-in/Memory',[sys,'/',['Envelop',13,'Detector1/Memory']])
set_param([sys,'/',['Envelop',13,'Detector1/Memory']],...
'position',[140,35,180,65])
add_block('built-in/Switch',[sys,'/',['Envelop',13,'Detector1/Switch']])
set_param([sys,'/',['Envelop',13,'Detector1/Switch']],...
'Threshold','eps',...
'position',[505,94,530,126])
add_block('built-in/Inport',[sys,'/',['Envelop',13,'Detector1/in_1']])
set_param([sys,'/',['Envelop',13,'Detector1/in_1']],...
'position',[15,100,35,120])
add_block('built-in/Gain',[sys,'/',['Envelop',13,'Detector1/Gain']])
set_param([sys,'/',['Envelop',13,'Detector1/Gain']],...
'Gain','g',...
'position',[65,100,85,120])
add_block('built-in/Outport',[sys,'/',['Envelop',13,'Detector1/out_1']])
set_param([sys,'/',['Envelop',13,'Detector1/out_1']],...
'position',[625,100,645,120])
add_block('built-in/Gain',[sys,'/',['Envelop',13,'Detector1/Gain1']])
set_param([sys,'/',['Envelop',13,'Detector1/Gain1']],...
'Gain','g',...
'position',[585,100,605,120])
add_line([sys,'/',['Envelop',13,'Detector1']],[185,50;195,50;195,100;220,100])
add_line([sys,'/',['Envelop',13,'Detector1']],[195,50;490,50;500,100])
add_line([sys,'/',['Envelop',13,'Detector1']],[345,140;355,140;355,115;380,115])
add_line([sys,'/',['Envelop',13,'Detector1']],[260,105;270,105;270,140;295,140])
add_line([sys,'/',['Envelop',13,'Detector1']],[270,105;380,105])
add_line([sys,'/',['Envelop',13,'Detector1']],[420,110;500,110])
add_line([sys,'/',['Envelop',13,'Detector1']],[535,110;560,110;560,170;540,170])
add_line([sys,'/',['Envelop',13,'Detector1']],[490,170;480,170;480,120;500,120])
add_line([sys,'/',['Envelop',13,'Detector1']],[40,110;60,110])
add_line([sys,'/',['Envelop',13,'Detector1']],[90,110;105,110;105,50;135,50])
add_line([sys,'/',['Envelop',13,'Detector1']],[105,110;220,110])
add_line([sys,'/',['Envelop',13,'Detector1']],[560,110;580,110])
add_line([sys,'/',['Envelop',13,'Detector1']],[610,110;620,110])
set_param([sys,'/',['Envelop',13,'Detector1']],...
'Mask Display','Envelop\nDetector',...
'Mask Type','Envelop Detector',...
'Mask Dialogue','Envelop Detector:|Boundary Side (''upper'' or ''lower''):')
set_param([sys,'/',['Envelop',13,'Detector1']],...
'Mask Translate','x=@1;if length(x)<2, error(''Error in Envelop Detector''); end; x=x(1:2); g=1; if x==''lo'', g=-1; end;',...
'Mask Help','Envelop Detector detects the envelop of a signal.')
set_param([sys,'/',['Envelop',13,'Detector1']],...
'Mask Entries','''lower''\/')
% Finished composite block ['Envelop',13,'Detector1'].
set_param([sys,'/',['Envelop',13,'Detector1']],...
'ForeGround',2,...
'position',[235,134,295,186])
add_block('built-in/Signal Generator',[sys,'/',['Signal',13,'Generator']])
set_param([sys,'/',['Signal',13,'Generator']],...
'ForeGround',5,...
'Peak','0.370000',...
'Peak Range','5.000000',...
'Freq','1.000000',...
'Freq Range','50.000000',...
'Wave','Sin',...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -