⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tsttdmaa.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 2 页
字号:
function [ret,x0,str,ts,xts]=tsttdmaa(t,x,u,flag);
%TSTTDMAA	is the M-file description of the SIMULINK system named TSTTDMAA.
%	The block-diagram can be displayed by typing: TSTTDMAA.
%
%	SYS=TSTTDMAA(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 TSTTDMAA 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 TSTTDMAA with a FLAG of zero:
%	[SIZES]=TSTTDMAA([],[],[],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',[17,79,662,323])
     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', '.020')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')


%     Subsystem  ['Time-sharing',13,'mux1'].

new_system([sys,'/',['Time-sharing',13,'mux1']])
set_param([sys,'/',['Time-sharing',13,'mux1']],'Location',[387,83,767,247])


%     Subsystem  ['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time'].

new_system([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']])
set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']],'Location',[55,192,283,286])

add_block('built-in/S-Function',[sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time/S-function1']])
set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time/S-function1']],...
		'function name','homopuls',...
		'parameters','samp_time, out_divid, offset',...
		'position',[40,31,105,59])

add_block('built-in/Outport',[sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time/Outport']])
set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time/Outport']],...
		'position',[160,35,180,55])
add_line([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']],[110,45;155,45])
set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']],...
		'Mask Display','Vector\nPulse',...
		'Mask Type','Pulse generator')
set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']],...
		'Mask Dialogue','Vector pulses with sample rate of each pulse as Sample_time ./Divider. |Sample time (scalar, sec):|Divider (integer vector):|Offset (have same dimension as Divider:')
set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']],...
		'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;')
set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']],...
		'Mask Help','This block generator a vector pulses. The output length is the same as the vector defined in "Divider". The ith element of the output has the sample time Sample_time/Divider(i). All elements in "Divider" must be integers.')
set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']],...
		'Mask Entries','td\/N\/0\/')


%     Finished composite block ['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time'].

set_param([sys,'/',['Time-sharing',13,'mux1/Pulses deivide',13,'same sample time']],...
		'position',[55,76,120,114])

add_block('built-in/Outport',[sys,'/',['Time-sharing',13,'mux1/out_1']])
set_param([sys,'/',['Time-sharing',13,'mux1/out_1']],...
		'position',[295,35,315,55])


%     Subsystem  ['Time-sharing',13,'mux1/Triggered time',13,'domain switch'].

new_system([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']])
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],'Location',[672,516,1052,680])

add_block('built-in/S-Function',[sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/S-function']])
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/S-function']],...
		'function name','stdmamux',...
		'parameters','sw,ke,in,tt',...
		'position',[205,60,275,90])

add_block('built-in/Inport',[sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/in_2']])
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/in_2']],...
		'Port','2',...
		'position',[60,75,80,95])

add_block('built-in/Outport',[sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/out_1']])
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/out_1']],...
		'position',[320,65,340,85])

add_block('built-in/Mux',[sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/Mux']])
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/Mux']],...
		'inputs','2',...
		'position',[145,54,175,96])

add_block('built-in/Inport',[sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/in_1']])
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch/in_1']],...
		'position',[65,20,85,40])
add_line([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],[280,75;315,75])
add_line([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],[180,75;200,75])
add_line([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],[85,85;140,85])
add_line([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],[90,30;120,30;120,65;140,65])
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],...
		'Mask Display','Vector\nredistributor',...
		'Mask Type','Triggered time domain switch')
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],...
		'Mask Dialogue','The rasing edge impulse from the 2nd inport triggers the output of this block by the distribution of the next row in the switch box variable.|Switch box:|Keeping value:|Initial value:|Trigger threshold:')
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],...
		'Mask Translate','sw=@1;ke=@2;in=@3;tt=@4;')
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],...
		'Mask Help','The column number of the switch box is the size of the output vector size, which is the size for vector keep_value and initial_value. The raising edge of the 2nd inport trigger the distribution pattern goes to the next row of the switch box.  When switch_box has value 0, the output keeps the last output value if keeping_value is greater than 0; the output is initial_value when the keep_value is less than 0.')
set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],...
		'Mask Entries','[1:N]''\/-1\/0\/.1\/')


%     Finished composite block ['Time-sharing',13,'mux1/Triggered time',13,'domain switch'].

set_param([sys,'/',['Time-sharing',13,'mux1/Triggered time',13,'domain switch']],...
		'position',[170,15,250,70])

add_block('built-in/Inport',[sys,'/',['Time-sharing',13,'mux1/in_1']])
set_param([sys,'/',['Time-sharing',13,'mux1/in_1']],...
		'position',[65,20,85,40])
add_line([sys,'/',['Time-sharing',13,'mux1']],[90,30;165,30])
add_line([sys,'/',['Time-sharing',13,'mux1']],[125,95;140,95;140,55;165,55])
add_line([sys,'/',['Time-sharing',13,'mux1']],[255,45;290,45])
set_param([sys,'/',['Time-sharing',13,'mux1']],...
		'Mask Display','Time-share\nmux',...
		'Mask Type','Time-sharing multiplex')
set_param([sys,'/',['Time-sharing',13,'mux1']],...
		'Mask Dialogue','This block partitions each transfer\nperiod into even length time slots. Each element of the input vector takes one\nslot in turn.|Transfer period (sec):|Input vector length:')
set_param([sys,'/',['Time-sharing',13,'mux1']],...
		'Mask Translate','td=@1;N=@2;')
set_param([sys,'/',['Time-sharing',13,'mux1']],...
		'Mask Help','This block outputs one element of the input vector in turn. The input for this block is a length N_in vector. The output for this block is a scalar. The transfer period T_out is partitioned into N_in slot. Each input element takes one partition in sequential order arranged by the position of the vector input. This block takes all elements in the input vector at the sampling time point.')
set_param([sys,'/',['Time-sharing',13,'mux1']],...
		'Mask Entries','1\/3\/')


%     Finished composite block ['Time-sharing',13,'mux1'].

set_param([sys,'/',['Time-sharing',13,'mux1']],...
		'hide name',0,...
		'position',[195,68,275,112])

add_block('built-in/Demux',[sys,'/','Demux'])
set_param([sys,'/','Demux'],...
		'hide name',0,...
		'outputs','3',...
		'position',[440,72,480,108])


%     Subsystem  ['Time-sharing',13,'demux1'].

new_system([sys,'/',['Time-sharing',13,'demux1']])
set_param([sys,'/',['Time-sharing',13,'demux1']],'Location',[11,84,349,247])


%     Subsystem  ['Time-sharing',13,'demux1/Triggered time',13,'domain switch'].

new_system([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch']])
set_param([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch']],'Location',[672,516,1052,680])

add_block('built-in/Inport',[sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/in_1']])
set_param([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/in_1']],...
		'position',[65,20,85,40])

add_block('built-in/Mux',[sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/Mux']])
set_param([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/Mux']],...
		'inputs','2',...
		'position',[145,54,175,96])

add_block('built-in/Outport',[sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/out_1']])
set_param([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/out_1']],...
		'position',[320,65,340,85])

add_block('built-in/Inport',[sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/in_2']])
set_param([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/in_2']],...
		'Port','2',...
		'position',[60,75,80,95])

add_block('built-in/S-Function',[sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/S-function']])
set_param([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch/S-function']],...
		'function name','stdmamux',...
		'parameters','sw,ke,in,tt',...
		'position',[205,60,275,90])
add_line([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch']],[90,30;120,30;120,65;140,65])
add_line([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch']],[85,85;140,85])
add_line([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch']],[180,75;200,75])
add_line([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch']],[280,75;315,75])
set_param([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch']],...
		'Mask Display','Vector\nredistributor',...
		'Mask Type','Triggered time domain switch')
set_param([sys,'/',['Time-sharing',13,'demux1/Triggered time',13,'domain switch']],...
		'Mask Dialogue','The rasing edge impulse from the 2nd inport triggers the output of this block by the distribution of the next row in the switch box variable.|Switch box:|Keeping value:|Initial value:|Trigger threshold:')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -