📄 tstrsinv.m
字号:
function [ret,x0,str,ts,xts]=tstrsinv(t,x,u,flag);
%TSTRSINV is the M-file description of the SIMULINK system named TSTRSINV.
% The block-diagram can be displayed by typing: TSTRSINV.
%
% SYS=TSTRSINV(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 TSTRSINV 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 TSTRSINV with a FLAG of zero:
% [SIZES]=TSTRSINV([],[],[],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',[90,172,841,457])
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','N_rs_demo=15;K_rs_demo=9;M_rs_demo=4;GWN=.05;');
% Subsystem ['K-step',13,'delay'].
new_system([sys,'/',['K-step',13,'delay']])
set_param([sys,'/',['K-step',13,'delay']],'Location',[12,432,357,702])
add_block('built-in/Relational Operator',[sys,'/',['K-step',13,'delay/Relational',13,'Operator']])
set_param([sys,'/',['K-step',13,'delay/Relational',13,'Operator']],...
'position',[150,168,180,192])
add_block('built-in/Constant',[sys,'/',['K-step',13,'delay/Constant1']])
set_param([sys,'/',['K-step',13,'delay/Constant1']],...
'Value','n*ts(1)+ts(2)',...
'position',[15,194,100,216])
add_block('built-in/Constant',[sys,'/',['K-step',13,'delay/Constant']])
set_param([sys,'/',['K-step',13,'delay/Constant']],...
'Value','ini',...
'position',[120,230,140,250])
add_block('built-in/Switch',[sys,'/',['K-step',13,'delay/Switch']])
set_param([sys,'/',['K-step',13,'delay/Switch']],...
'Threshold','.1',...
'position',[270,114,295,146])
add_block('built-in/Filter',[sys,'/',['K-step',13,'delay/K-step',13,'delay']])
set_param([sys,'/',['K-step',13,'delay/K-step',13,'delay']],...
'Numerator','[zeros(1,n), 1]',...
'Denominator','1',...
'Sample time','ts',...
'position',[60,70,185,110])
add_block('built-in/Outport',[sys,'/',['K-step',13,'delay/out_1']])
set_param([sys,'/',['K-step',13,'delay/out_1']],...
'position',[325,120,345,140])
add_block('built-in/Inport',[sys,'/',['K-step',13,'delay/in_1']])
set_param([sys,'/',['K-step',13,'delay/in_1']],...
'position',[20,80,40,100])
add_block('built-in/Digital Clock',[sys,'/',['K-step',13,'delay/Digital Clock']])
set_param([sys,'/',['K-step',13,'delay/Digital Clock']],...
'Sample time','ts',...
'position',[60,140,95,170])
add_line([sys,'/',['K-step',13,'delay']],[185,180;220,180;220,130;265,130])
add_line([sys,'/',['K-step',13,'delay']],[105,205;115,205;115,185;145,185])
add_line([sys,'/',['K-step',13,'delay']],[100,155;115,155;115,175;145,175])
add_line([sys,'/',['K-step',13,'delay']],[145,240;240,240;240,140;265,140])
add_line([sys,'/',['K-step',13,'delay']],[190,90;195,90;195,120;265,120])
add_line([sys,'/',['K-step',13,'delay']],[45,90;55,90])
add_line([sys,'/',['K-step',13,'delay']],[300,130;320,130])
set_param([sys,'/',['K-step',13,'delay']],...
'Mask Display',' -k\nz ',...
'Mask Type','Multi-step delay',...
'Mask Dialogue','Output is K-step delay of the input signal.|Delay steps (integer):|Sample time (sec):|Initial output:')
set_param([sys,'/',['K-step',13,'delay']],...
'Mask Translate','n=@1;ts=@2;if length(ts)<2, ts=[ts 0];end;ini=@3;')
set_param([sys,'/',['K-step',13,'delay']],...
'Mask Help','This block holds the input signal for K steps and then outputs the signal. The delay step cannot be changed during the simulation.',...
'Mask Entries','N_rs_demo\/1/N_rs_demo\/0\/')
% Finished composite block ['K-step',13,'delay'].
set_param([sys,'/',['K-step',13,'delay']],...
'ForeGround',3,...
'hide name',0,...
'position',[490,153,570,197])
add_block('built-in/Mux',[sys,'/','Mux'])
set_param([sys,'/','Mux'],...
'hide name',0,...
'inputs','2',...
'position',[600,131,630,164])
% Subsystem ['Placed and',13,'detected errors'].
new_system([sys,'/',['Placed and',13,'detected errors']])
set_param([sys,'/',['Placed and',13,'detected errors']],'Location',[0,59,274,252])
add_block('built-in/S-Function',[sys,'/',['Placed and',13,'detected errors/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['Placed and',13,'detected errors/S-function',13,'M-file which plots',13,'lines',13,'']],...
'function name','sfuny',...
'parameters','ax, color,dt',...
'position',[130,55,180,75])
add_block('built-in/Inport',[sys,'/',['Placed and',13,'detected errors/x']])
set_param([sys,'/',['Placed and',13,'detected errors/x']],...
'position',[65,55,85,75])
add_line([sys,'/',['Placed and',13,'detected errors']],[90,65;125,65])
set_param([sys,'/',['Placed and',13,'detected errors']],...
'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...
'Mask Type','Graph scope.')
set_param([sys,'/',['Placed and',13,'detected errors']],...
'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type.|Time range:|y-min:|y-max:|Line type (rgbw-:*). Seperate each plot by ''/'':')
set_param([sys,'/',['Placed and',13,'detected errors']],...
'Mask Translate','color = @4; ax = [0, @1, @2, @3]; dt = -1;')
set_param([sys,'/',['Placed and',13,'detected errors']],...
'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works. This block can take scalar or vector input signal.')
set_param([sys,'/',['Placed and',13,'detected errors']],...
'Mask Entries','5\/-1.1\/5\/''r-/g--/c-./w:/m*/ro/b+''\/')
% Finished composite block ['Placed and',13,'detected errors'].
set_param([sys,'/',['Placed and',13,'detected errors']],...
'position',[655,131,685,169])
% Subsystem 'Counter'.
new_system([sys,'/','Counter'])
set_param([sys,'/','Counter'],'Location',[128,50,722,374])
add_block('built-in/Constant',[sys,'/','Counter/Constant'])
set_param([sys,'/','Counter/Constant'],...
'ForeGround',3,...
'Value','thld',...
'position',[105,100,135,120])
add_block('built-in/Relational Operator',[sys,'/',['Counter/Relational',13,'Operator1']])
set_param([sys,'/',['Counter/Relational',13,'Operator1']],...
'ForeGround',2,...
'Operator','>',...
'position',[225,53,255,77])
add_block('built-in/Sum',[sys,'/','Counter/Sum'])
set_param([sys,'/','Counter/Sum'],...
'ForeGround',3,...
'position',[295,100,315,120])
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/Inport',[sys,'/','Counter/in_1'])
set_param([sys,'/','Counter/in_1'],...
'position',[15,50,35,70])
add_block('built-in/Inport',[sys,'/','Counter/in_2'])
set_param([sys,'/','Counter/in_2'],...
'Port','2',...
'position',[15,155,35,175])
% 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/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_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/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/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/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/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/Relational Operator',[sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator']])
set_param([sys,'/',['Counter/Rising edge',13,'detector/Relational',13,'Operator']],...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -