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

📄 commu.m

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


%     Subsystem  'Illustrative blocks'.

new_system([sys,'/','Illustrative blocks'])
set_param([sys,'/','Illustrative blocks'],'Location',[79,60,885,251])
set_param([sys,'/','Illustrative blocks'],...
		'Mask Display','.')


%     Finished composite block 'Illustrative blocks'.

set_param([sys,'/','Illustrative blocks'],...
		'orientation',1,...
		'ForeGround',6,...
		'position',[110,347,153,370])


%     Subsystem  'Demonstration blocks'.

new_system([sys,'/','Demonstration blocks'])
set_param([sys,'/','Demonstration blocks'],'Location',[89,142,895,373])

add_block('built-in/Note',[sys,'/','Demonstration blocks/The original test file is in comtest//comtest.m'])
set_param([sys,'/','Demonstration blocks/The original test file is in comtest//comtest.m'],...
		'position',[245,70,250,75])
set_param([sys,'/','Demonstration blocks'],...
		'Mask Display','.')


%     Finished composite block 'Demonstration blocks'.

set_param([sys,'/','Demonstration blocks'],...
		'orientation',1,...
		'BackGround',7,...
		'position',[60,326,103,349])


%     Subsystem  'Available blocks'.

new_system([sys,'/','Available blocks'])
set_param([sys,'/','Available blocks'],'Location',[79,60,885,176])

add_block('built-in/Note',[sys,'/',['Available blocks/This library contains transmitter and receiver. The receiving part is almost reverse of the transmitting part. For a clear',13,'relationshipe, when a transmitter block is clicked, the function for the receiving will also be shown up and vice verse.            ']])
set_param([sys,'/',['Available blocks/This library contains transmitter and receiver. The receiving part is almost reverse of the transmitting part. For a clear',13,'relationshipe, when a transmitter block is clicked, the function for the receiving will also be shown up and vice verse.            ']],...
		'position',[380,40,385,45])
set_param([sys,'/','Available blocks'],...
		'Mask Display','.')


%     Finished composite block 'Available blocks'.

set_param([sys,'/','Available blocks'],...
		'orientation',1,...
		'position',[10,305,53,328])


%     Subsystem  'information1'.

new_system([sys,'/','information1'])
set_param([sys,'/','information1'],'Location',[198,474,1004,748])

add_block('built-in/Note',[sys,'/','information1/The transmitting blocks has orientation from left to right. The receiving blocks has orientation from right to left.'])
set_param([sys,'/','information1/The transmitting blocks has orientation from left to right. The receiving blocks has orientation from right to left.'],...
		'position',[350,80,355,85])

add_block('built-in/Note',[sys,'/',['information1/black+blue blocks => typical ANALOG communication system.                          ',13,'',13,'black+green blocks => minimum configuration of a DIGITAL communication system.',13,'',13,'black+green+red blocks => maximum configuration of a DIGITAL communication system.      ']])
set_param([sys,'/',['information1/black+blue blocks => typical ANALOG communication system.                          ',13,'',13,'black+green blocks => minimum configuration of a DIGITAL communication system.',13,'',13,'black+green+red blocks => maximum configuration of a DIGITAL communication system.      ']],...
		'position',[335,115,340,120])

add_block('built-in/Note',[sys,'/',['information1/This library contains transmitter and receiver. The receiving part is almost reverse of the transmitting part. For a clear',13,'relationshipe, when a transmitter block is clicked, the function for the receiving will also be shown up and vice verse.            ']])
set_param([sys,'/',['information1/This library contains transmitter and receiver. The receiving part is almost reverse of the transmitting part. For a clear',13,'relationshipe, when a transmitter block is clicked, the function for the receiving will also be shown up and vice verse.            ']],...
		'position',[380,40,385,45])
set_param([sys,'/','information1'],...
		'Mask Display','Tutorial',...
		'Mask Dialogue','eval(''hthelp commhelp'')')


%     Finished composite block 'information1'.

set_param([sys,'/','information1'],...
		'BackGround',7,...
		'hide name',0,...
		'position',[10,251,90,295])


%     Subsystem  ['Store N',13,'Display'].

new_system([sys,'/',['Store N',13,'Display']])
set_param([sys,'/',['Store N',13,'Display']],'Location',[427,463,684,617])

add_block('built-in/Inport',[sys,'/',['Store N',13,'Display/in_1']])
set_param([sys,'/',['Store N',13,'Display/in_1']],...
		'position',[55,45,75,65])
set_param([sys,'/',['Store N',13,'Display']],...
		'Mask Display','Sink',...
		'Mask Dialogue','eval(''com_sour;'');')


%     Finished composite block ['Store N',13,'Display'].

set_param([sys,'/',['Store N',13,'Display']],...
		'orientation',2,...
		'hide name',0,...
		'position',[10,188,90,232])


%     Subsystem  '15//11'.

new_system([sys,'/','15//11'])
set_param([sys,'/','15//11'],'Location',[185,105,363,240])

add_block('built-in/Outport',[sys,'/','15//11/out_1'])
set_param([sys,'/','15//11/out_1'],...
		'position',[110,60,130,80])
set_param([sys,'/','15//11'],...
		'Mask Display','Source',...
		'Mask Type','Source',...
		'Mask Dialogue','eval(''com_sour;'')')


%     Finished composite block '15//11'.

set_param([sys,'/','15//11'],...
		'hide name',0,...
		'position',[10,53,90,97])

add_block('built-in/Note',[sys,'/','COMMUNICATIONS TOOLBOX SIMULINK BLOCK LIBRARY'])
set_param([sys,'/','COMMUNICATIONS TOOLBOX SIMULINK BLOCK LIBRARY'],...
		'ForeGround',2,...
		'Font Name','times',...
		'Font Weight','bold',...
		'Font Angle','italic',...
		'Font Size',14,...
		'position',[305,10,310,15])


%     Subsystem  'information'.

new_system([sys,'/','information'])
set_param([sys,'/','information'],'Location',[79,60,855,183])

add_block('built-in/Note',[sys,'/','information/This library contains transmitter and receiver function blocks. The receiving part is almost reverse of the transmitting part.            '])
set_param([sys,'/','information/This library contains transmitter and receiver function blocks. The receiving part is almost reverse of the transmitting part.            '],...
		'position',[390,30,395,35])

add_block('built-in/Note',[sys,'/','information/The transmitting blocks have orientation from left to right. The receiving blocks have orientation from right to left.'])
set_param([sys,'/','information/The transmitting blocks have orientation from left to right. The receiving blocks have orientation from right to left.'],...
		'position',[335,70,340,75])

add_block('built-in/Note',[sys,'/','information/ For a clear relationship, when a transmitter block is clicked, the function for the receiving will also be shown up and vice verse.'])
set_param([sys,'/','information/ For a clear relationship, when a transmitter block is clicked, the function for the receiving will also be shown up and vice verse.'],...
		'position',[380,50,385,55])
set_param([sys,'/','information'],...
		'Mask Display','?')


%     Finished composite block 'information'.

set_param([sys,'/','information'],...
		'ForeGround',6,...
		'hide name',0,...
		'position',[425,251,475,295])


%     Subsystem  'Utility'.

new_system([sys,'/','Utility'])
set_param([sys,'/','Utility'],'Location',[136,230,381,439])
set_param([sys,'/','Utility'],...
		'Mask Display','Demos',...
		'Mask Dialogue','eval(''com_clos;com_case;%the old one is comtest'')')


%     Finished composite block 'Utility'.

set_param([sys,'/','Utility'],...
		'BackGround',7,...
		'hide name',0,...
		'position',[320,251,400,295])


%     Subsystem  '21//2'.

new_system([sys,'/','21//2'])
set_param([sys,'/','21//2'],'Location',[136,230,381,439])
set_param([sys,'/','21//2'],...
		'Mask Display','Utilities\n/misc',...
		'Mask Dialogue','eval(''com_clos;com_util;'')')


%     Finished composite block '21//2'.

set_param([sys,'/','21//2'],...
		'hide name',0,...
		'position',[215,251,295,295])


%     Subsystem  '4//0'.

new_system([sys,'/','4//0'])
set_param([sys,'/','4//0'],'Location',[618,158,867,453])
set_param([sys,'/','4//0'],...
		'Mask Display','Synchronization',...
		'Mask Dialogue','eval(''com_clos;com_sync;'')')


%     Finished composite block '4//0'.

set_param([sys,'/','4//0'],...
		'hide name',0,...
		'position',[105,251,200,296])


%     Subsystem  '30//14'.

new_system([sys,'/','30//14'])
set_param([sys,'/','30//14'],'Location',[474,259,732,444])

add_block('built-in/Inport',[sys,'/','30//14/in_1'])
set_param([sys,'/','30//14/in_1'],...
		'position',[35,75,55,95])

add_block('built-in/Outport',[sys,'/','30//14/out_1'])
set_param([sys,'/','30//14/out_1'],...
		'position',[145,74,165,96])
add_line([sys,'/','30//14'],[60,85;140,85])
set_param([sys,'/','30//14'],...
		'Mask Display','Error\ncontrol\ncoding',...
		'Mask Dialogue','eval(''com_code;'');')


%     Finished composite block '30//14'.

set_param([sys,'/','30//14'],...
		'hide name',0,...
		'position',[205,53,285,97])


%     Subsystem  'R_Format'.

new_system([sys,'/','R_Format'])
set_param([sys,'/','R_Format'],'Location',[376,224,586,342])

add_block('built-in/Outport',[sys,'/','R_Format/out_1'])
set_param([sys,'/','R_Format/out_1'],...
		'orientation',2,...
		'position',[50,55,70,75])

add_block('built-in/Inport',[sys,'/','R_Format/in_1'])
set_param([sys,'/','R_Format/in_1'],...
		'orientation',2,...
		'position',[165,55,185,75])
add_line([sys,'/','R_Format'],[160,65;75,65])
set_param([sys,'/','R_Format'],...
		'Mask Display','Source\ndecoding',...
		'Mask Dialogue','eval(''com_frmt;'')')


%     Finished composite block 'R_Format'.

set_param([sys,'/','R_Format'],...
		'orientation',2,...
		'hide name',0,...
		'position',[105,188,185,232])


%     Subsystem  '10//3'.

new_system([sys,'/','10//3'])
set_param([sys,'/','10//3'],'Location',[196,122,458,241])

add_block('built-in/Inport',[sys,'/','10//3/in_1'])
set_param([sys,'/','10//3/in_1'],...
		'position',[35,55,55,75])

add_block('built-in/Outport',[sys,'/','10//3/out_1'])
set_param([sys,'/','10//3/out_1'],...
		'position',[175,55,195,75])
add_line([sys,'/','10//3'],[60,65;170,65])

⌨️ 快捷键说明

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