📄 tstam.m
字号:
function [ret,x0,str,ts,xts]=tstam(t,x,u,flag);
%TSTAM is the M-file description of the SIMULINK system named TSTAM.
% The block-diagram can be displayed by typing: TSTAM.
%
% SYS=TSTAM(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 TSTAM 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 TSTAM with a FLAG of zero:
% [SIZES]=TSTAM([],[],[],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',[36,79,816,331])
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', '.005')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars', '')
% Subsystem ['DSB-SC',13,'AM'].
new_system([sys,'/',['DSB-SC',13,'AM']])
set_param([sys,'/',['DSB-SC',13,'AM']],'Location',[112,331,527,488])
add_block('built-in/Constant',[sys,'/',['DSB-SC',13,'AM/Constant']])
set_param([sys,'/',['DSB-SC',13,'AM/Constant']],...
'Value','Fc',...
'position',[30,75,50,95])
% Subsystem ['DSB-SC',13,'AM/Module',13,'Integrator'].
new_system([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],'Location',[196,490,621,627])
add_block('built-in/Outport',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/out_1']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/out_1']],...
'position',[370,30,390,50])
add_block('built-in/Sum',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Sum']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Sum']],...
'position',[195,30,215,50])
add_block('built-in/Constant',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/one']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/one']],...
'orientation',3,...
'move name',0,...
'position',[70,55,90,75])
add_block('built-in/Reset Integrator',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Reset',13,'integrator']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Reset',13,'integrator']],...
'position',[110,19,150,51])
add_block('built-in/Fcn',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/module']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/module']],...
'Expr','rem(u[1],modu)',...
'position',[235,29,325,51])
add_block('built-in/Memory',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Memory']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/Memory']],...
'orientation',2,...
'x0','init',...
'position',[210,75,260,105])
add_block('built-in/Inport',[sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/in_1']])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator/in_1']],...
'position',[35,15,55,35])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[330,40;365,40])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[340,40;340,90;265,90])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[80,50;80,35;105,35])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[60,25;105,25])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[220,40;230,40])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[155,35;190,35])
add_line([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],[205,90;180,90;190,45])
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
'Mask Display','Mod\nint',...
'Mask Type','Module Integrator',...
'Mask Dialogue','Module the given number when state exceed limit|Module bound:|Initial value:')
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
'Mask Translate','init=@2; modu=@1;')
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
'Mask Help','The absolute value of this integrator will not exceed the specified module bound. The state value is set to be zero when the module bound is reached. This block can only be used for scale value calculation.')
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
'Mask Entries','1\/0\/')
% Finished composite block ['DSB-SC',13,'AM/Module',13,'Integrator'].
set_param([sys,'/',['DSB-SC',13,'AM/Module',13,'Integrator']],...
'position',[75,64,140,106])
add_block('built-in/Fcn',[sys,'/',['DSB-SC',13,'AM/Fcn']])
set_param([sys,'/',['DSB-SC',13,'AM/Fcn']],...
'Expr','sin(u[1]*pi2+Ph)',...
'position',[160,71,280,99])
add_block('built-in/Outport',[sys,'/',['DSB-SC',13,'AM/out_1']])
set_param([sys,'/',['DSB-SC',13,'AM/out_1']],...
'position',[380,50,400,70])
add_block('built-in/Inport',[sys,'/',['DSB-SC',13,'AM/in_1']])
set_param([sys,'/',['DSB-SC',13,'AM/in_1']],...
'position',[230,15,250,35])
add_block('built-in/Product',[sys,'/',['DSB-SC',13,'AM/Product']])
set_param([sys,'/',['DSB-SC',13,'AM/Product']],...
'position',[340,42,365,73])
add_line([sys,'/',['DSB-SC',13,'AM']],[255,25;310,25;310,50;335,50])
add_line([sys,'/',['DSB-SC',13,'AM']],[370,60;375,60])
add_line([sys,'/',['DSB-SC',13,'AM']],[55,85;70,85])
add_line([sys,'/',['DSB-SC',13,'AM']],[145,85;155,85])
add_line([sys,'/',['DSB-SC',13,'AM']],[285,85;305,85;305,65;335,65])
set_param([sys,'/',['DSB-SC',13,'AM']],...
'Mask Display','DSB-SC\nAM',...
'Mask Type','DSB-SC AM')
set_param([sys,'/',['DSB-SC',13,'AM']],...
'Mask Dialogue','Double-sideband suppressed-carrier amplitude modulation:|Amplitude scale factor:|Carrier frequency (Hz):|Initial Phase (rad):',...
'Mask Translate','Ac=@1;Fc=@2;Ph=@3;pi2=2*pi;')
set_param([sys,'/',['DSB-SC',13,'AM']],...
'Mask Help','The Double-Sideband-Supressed-Carrier Amplitude Modulation causes the amplitude of the sinusoidal carrier to depend on the input message signal, resulting in amplitude modulation.')
set_param([sys,'/',['DSB-SC',13,'AM']],...
'Mask Entries','1\/100\/0\/')
% Finished composite block ['DSB-SC',13,'AM'].
set_param([sys,'/',['DSB-SC',13,'AM']],...
'position',[255,22,315,58])
add_block('built-in/Sine Wave',[sys,'/','Sine wave'])
set_param([sys,'/','Sine wave'],...
'ForeGround',2,...
'frequency','30',...
'position',[145,30,165,50])
add_block('built-in/Mux',[sys,'/','Mux1'])
set_param([sys,'/','Mux1'],...
'orientation',2,...
'inputs','5',...
'position',[140,70,180,100])
% Subsystem ['AM with',13,'Carrier1'].
new_system([sys,'/',['AM with',13,'Carrier1']])
set_param([sys,'/',['AM with',13,'Carrier1']],'Location',[184,550,815,693])
add_block('built-in/Note',[sys,'/',['AM with',13,'Carrier1/Ref: Hambley: An Intro to Comm. Systems. pp76']])
set_param([sys,'/',['AM with',13,'Carrier1/Ref: Hambley: An Intro to Comm. Systems. pp76']],...
'position',[180,155,185,160])
% Subsystem ['AM with',13,'Carrier1/Module',13,'Integrator'].
new_system([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],'Location',[196,490,621,627])
add_block('built-in/Inport',[sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/in_1']])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/in_1']],...
'position',[35,15,55,35])
add_block('built-in/Memory',[sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/Memory']])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/Memory']],...
'orientation',2,...
'x0','init',...
'position',[210,75,260,105])
add_block('built-in/Fcn',[sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/module']])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/module']],...
'Expr','rem(u[1],modu)',...
'position',[235,29,325,51])
add_block('built-in/Reset Integrator',[sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/Reset',13,'integrator']])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/Reset',13,'integrator']],...
'position',[110,19,150,51])
add_block('built-in/Constant',[sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/one']])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/one']],...
'orientation',3,...
'move name',0,...
'position',[70,55,90,75])
add_block('built-in/Sum',[sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/Sum']])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/Sum']],...
'position',[195,30,215,50])
add_block('built-in/Outport',[sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/out_1']])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator/out_1']],...
'position',[370,30,390,50])
add_line([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],[205,90;180,90;190,45])
add_line([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],[155,35;190,35])
add_line([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],[220,40;230,40])
add_line([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],[330,40;365,40])
add_line([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],[60,25;105,25])
add_line([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],[80,50;80,35;105,35])
add_line([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],[340,40;340,90;265,90])
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],...
'Mask Display','Mod\nint',...
'Mask Type','Module Integrator',...
'Mask Dialogue','Module the given number when state exceed limit|Module bound:|Initial value:')
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],...
'Mask Translate','init=@2; modu=@1;')
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],...
'Mask Help','The absolute value of this integrator will not exceed the specified module bound. The state value is set to be zero when the module bound is reached. This block can only be used for scale value calculation.')
set_param([sys,'/',['AM with',13,'Carrier1/Module',13,'Integrator']],...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -