📄 tstlinsq.m
字号:
function [ret,x0,str,ts,xts]=tstlinsq(t,x,u,flag);
%TSTLINSQ is the M-file description of the SIMULINK system named TSTLINSQ.
% The block-diagram can be displayed by typing: TSTLINSQ.
%
% SYS=TSTLINSQ(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 TSTLINSQ 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 TSTLINSQ with a FLAG of zero:
% [SIZES]=TSTLINSQ([],[],[],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',[47,105,688,292])
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', '')
set_param(sys,'Load callback','[wast,G_lin]=hammgen(3);trt=0;GWN=.01;');
add_block('built-in/Scope',[sys,'/','Error placed'])
set_param([sys,'/','Error placed'],...
'hide name',0,...
'Vgain','3.000000',...
'Hgain','7.000000',...
'Vmax','6.000000',...
'Hmax','14.000000',...
'Window',[343,293,807,584])
open_system([sys,'/','Error placed'])
set_param([sys,'/','Error placed'],...
'position',[505,107,525,133])
% Subsystem 'Counter'.
new_system([sys,'/','Counter'])
set_param([sys,'/','Counter'],'Location',[128,50,722,374])
% Subsystem ['Counter/Rising edge',13,'detector1'].
new_system([sys,'/',['Counter/Rising edge',13,'detector1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1']],'Location',[303,485,692,659])
add_block('built-in/Outport',[sys,'/',['Counter/Rising edge',13,'detector1/out_1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/out_1']],...
'position',[340,25,360,45])
add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator1']],...
'position',[200,88,230,112])
add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator2']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator2']],...
'Operator','>',...
'position',[265,23,295,47])
add_block('built-in/Constant',[sys,'/',['Counter/Rising edge',13,'detector1/one1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/one1']],...
'Value','thld',...
'position',[30,135,60,155])
add_block('built-in/Memory',[sys,'/',['Counter/Rising edge',13,'detector1/Memory1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/Memory1']],...
'position',[125,80,165,110])
add_block('built-in/Inport',[sys,'/',['Counter/Rising edge',13,'detector1/in_1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/in_1']],...
'position',[10,15,30,35])
add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator']])
set_param([sys,'/',['Counter/Rising edge',13,'detector1/Relational',13,'Operator']],...
'position',[135,18,165,42])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[35,25;130,25])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[45,25;45,95;120,95])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[170,95;195,95])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[65,145;100,145;100,35;130,35])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[100,145;180,145;180,105;195,105])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[170,30;260,30])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[235,100;240,100;240,40;260,40])
add_line([sys,'/',['Counter/Rising edge',13,'detector1']],[300,35;335,35])
set_param([sys,'/',['Counter/Rising edge',13,'detector1']],...
'Mask Display','Edge\ndetector',...
'Mask Type','Edge Detection',...
'Mask Dialogue','Rising edge detection:|Threshold:',...
'Mask Translate','thld=@1;')
set_param([sys,'/',['Counter/Rising edge',13,'detector1']],...
'Mask Help','When the input signal rising edge passed the given shreshold, this block outputs one, otherwise outputs zero.',...
'Mask Entries','thld\/')
% Finished composite block ['Counter/Rising edge',13,'detector1'].
set_param([sys,'/',['Counter/Rising edge',13,'detector1']],...
'ForeGround',4,...
'position',[375,53,435,87])
add_block('built-in/Inport',[sys,'/','Counter/in_3'])
set_param([sys,'/','Counter/in_3'],...
'Port','3',...
'position',[315,60,335,80])
add_block('built-in/Memory',[sys,'/','Counter/Memory3'])
set_param([sys,'/','Counter/Memory3'],...
'orientation',2,...
'ForeGround',3,...
'position',[400,205,440,235])
add_block('built-in/Switch',[sys,'/','Counter/Switch3'])
set_param([sys,'/','Counter/Switch3'],...
'ForeGround',3,...
'Threshold','eps',...
'position',[470,139,495,171])
add_block('built-in/Outport',[sys,'/','Counter/out_1'])
set_param([sys,'/','Counter/out_1'],...
'position',[550,145,570,165])
% Subsystem ['Counter/Rising edge',13,'detector'].
new_system([sys,'/',['Counter/Rising edge',13,'detector']])
set_param([sys,'/',['Counter/Rising edge',13,'detector']],'Location',[303,485,692,659])
add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator']],...
'position',[135,18,165,42])
add_block('built-in/Inport',[sys,'/',['Counter/Rising edge',13,'detector/in_1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/in_1']],...
'position',[10,15,30,35])
add_block('built-in/Memory',[sys,'/',['Counter/Rising edge',13,'detector/Memory1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/Memory1']],...
'position',[125,80,165,110])
add_block('built-in/Constant',[sys,'/',['Counter/Rising edge',13,'detector/one1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/one1']],...
'Value','thld',...
'position',[30,135,60,155])
add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator2']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator2']],...
'Operator','>',...
'position',[265,23,295,47])
add_block('built-in/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator1']],...
'position',[200,88,230,112])
add_block('built-in/Outport',[sys,'/',['Counter/Rising edge',13,'detector/out_1']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/out_1']],...
'position',[340,25,360,45])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[300,35;335,35])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[235,100;240,100;240,40;260,40])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[170,30;260,30])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[65,145;100,145;100,35;130,35])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[100,145;180,145;180,105;195,105])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[170,95;195,95])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[35,25;130,25])
add_line([sys,'/',['Counter/Rising edge',13,'detector']],[45,25;45,95;120,95])
set_param([sys,'/',['Counter/Rising edge',13,'detector']],...
'Mask Display','Edge\ndetector',...
'Mask Type','Edge Detection',...
'Mask Dialogue','Rising edge detection:|Threshold:',...
'Mask Translate','thld=@1;')
set_param([sys,'/',['Counter/Rising edge',13,'detector']],...
'Mask Help','When the input signal rising edge passed the given shreshold, this block outputs one, otherwise outputs zero.',...
'Mask Entries','thld\/')
% Finished composite block ['Counter/Rising edge',13,'detector'].
set_param([sys,'/',['Counter/Rising edge',13,'detector']],...
'ForeGround',4,...
'position',[80,148,140,182])
add_block('built-in/Inport',[sys,'/','Counter/in_2'])
set_param([sys,'/','Counter/in_2'],...
'Port','2',...
'position',[15,155,35,175])
add_block('built-in/Inport',[sys,'/','Counter/in_1'])
set_param([sys,'/','Counter/in_1'],...
'position',[15,50,35,70])
add_block('built-in/Switch',[sys,'/','Counter/Switch2'])
set_param([sys,'/','Counter/Switch2'],...
'ForeGround',3,...
'Threshold','eps',...
'position',[345,149,370,181])
add_block('built-in/Sum',[sys,'/','Counter/Sum'])
set_param([sys,'/','Counter/Sum'],...
'ForeGround',3,...
'position',[295,100,315,120])
add_block('built-in/Relational Operator',[sys,'/',['Counter/Relational',13,'Operator1']])
set_param([sys,'/',['Counter/Relational',13,'Operator1']],...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -