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

📄 com_momp.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 5 页
字号:
function [ret,x0,str,ts,xts]=com_momp(t,x,u,flag);
%COM_MOMP	is the M-file description of the SIMULINK system named COM_MOMP.
%	The block-diagram can be displayed by typing: COM_MOMP.
%
%	SYS=COM_MOMP(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 COM_MOMP 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 COM_MOMP with a FLAG of zero:
%	[SIZES]=COM_MOMP([],[],[],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',[71,44,710,709])
     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  'Blocks that can be found in some other sublibraries in this toolbox'.

new_system([sys,'/','Blocks that can be found in some other sublibraries in this toolbox'])
set_param([sys,'/','Blocks that can be found in some other sublibraries in this toolbox'],'Location',[175,552,335,697])
set_param([sys,'/','Blocks that can be found in some other sublibraries in this toolbox'],...
		'Mask Display','.')


%     Finished composite block 'Blocks that can be found in some other sublibraries in this toolbox'.

set_param([sys,'/','Blocks that can be found in some other sublibraries in this toolbox'],...
		'orientation',1,...
		'ForeGround',4,...
		'position',[35,635,90,658])


%     Subsystem  'Mapping//demapping blocks '.

new_system([sys,'/','Mapping//demapping blocks '])
set_param([sys,'/','Mapping//demapping blocks '],'Location',[175,552,335,697])
set_param([sys,'/','Mapping//demapping blocks '],...
		'Mask Display','.')


%     Finished composite block 'Mapping//demapping blocks '.

set_param([sys,'/','Mapping//demapping blocks '],...
		'orientation',1,...
		'position',[35,605,90,628])


%     Subsystem  'Demonstration blocks'.

new_system([sys,'/','Demonstration blocks'])
set_param([sys,'/','Demonstration blocks'],'Location',[175,552,335,697])
set_param([sys,'/','Demonstration blocks'],...
		'Mask Display','.')


%     Finished composite block 'Demonstration blocks'.

set_param([sys,'/','Demonstration blocks'],...
		'orientation',1,...
		'BackGround',7,...
		'position',[35,575,90,598])


%     Subsystem  ['QAM',13,'baseband'].

new_system([sys,'/',['QAM',13,'baseband']])
set_param([sys,'/',['QAM',13,'baseband']],'Location',[321,500,954,793])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband/Ref: Hambley: An Intro to Comm. Systems. pp72']])
set_param([sys,'/',['QAM',13,'baseband/Ref: Hambley: An Intro to Comm. Systems. pp72']],...
		'position',[260,370,265,375])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband/I_out']])
set_param([sys,'/',['QAM',13,'baseband/I_out']],...
		'position',[445,206,450,211])

add_block('built-in/Sum',[sys,'/',['QAM',13,'baseband/Sum1']])
set_param([sys,'/',['QAM',13,'baseband/Sum1']],...
		'position',[385,210,405,230])

add_block('built-in/Product',[sys,'/',['QAM',13,'baseband/Product2']])
set_param([sys,'/',['QAM',13,'baseband/Product2']],...
		'position',[310,228,340,252])

add_block('built-in/Product',[sys,'/',['QAM',13,'baseband/Product3']])
set_param([sys,'/',['QAM',13,'baseband/Product3']],...
		'position',[310,183,340,207])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband/I2']])
set_param([sys,'/',['QAM',13,'baseband/I2']],...
		'position',[190,155,195,160])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband/R2']])
set_param([sys,'/',['QAM',13,'baseband/R2']],...
		'position',[125,135,130,140])

add_block('built-in/Inport',[sys,'/',['QAM',13,'baseband/in_2']])
set_param([sys,'/',['QAM',13,'baseband/in_2']],...
		'Port','2',...
		'position',[135,55,155,75])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband/I1']])
set_param([sys,'/',['QAM',13,'baseband/I1']],...
		'position',[193,43,198,48])

add_block('built-in/Constant',[sys,'/',['QAM',13,'baseband/Constant1']])
set_param([sys,'/',['QAM',13,'baseband/Constant1']],...
		'Value','x2',...
		'position',[130,165,150,185])

add_block('built-in/Constant',[sys,'/',['QAM',13,'baseband/Constant']])
set_param([sys,'/',['QAM',13,'baseband/Constant']],...
		'Value','x1',...
		'position',[80,145,100,165])

add_block('built-in/Outport',[sys,'/',['QAM',13,'baseband/out_1']])
set_param([sys,'/',['QAM',13,'baseband/out_1']],...
		'position',[585,130,605,150])

add_block('built-in/Inport',[sys,'/',['QAM',13,'baseband/in_1']])
set_param([sys,'/',['QAM',13,'baseband/in_1']],...
		'position',[95,30,115,50])

add_block('built-in/Mux',[sys,'/',['QAM',13,'baseband/RI2C']])
set_param([sys,'/',['QAM',13,'baseband/RI2C']],...
		'inputs','2',...
		'Mask Display','Real/Imag\nto Complex',...
		'Mask Type','Real/Imag to Complex',...
		'Mask Dialogue','Construct complex vector from real and imaginary vectors.')
set_param([sys,'/',['QAM',13,'baseband/RI2C']],...
		'Mask Help','The Real/Imag to Complex block creates a complex output from the two inputs. It uses a Mux block to append the complex part (input 2) to the real part (input 1).')
set_param([sys,'/',['QAM',13,'baseband/RI2C']],...
		'position',[470,119,545,161])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband/R_out']])
set_param([sys,'/',['QAM',13,'baseband/R_out']],...
		'position',[445,45,450,50])

add_block('built-in/Sum',[sys,'/',['QAM',13,'baseband/Sum']])
set_param([sys,'/',['QAM',13,'baseband/Sum']],...
		'inputs','+-',...
		'position',[375,60,395,80])

add_block('built-in/Product',[sys,'/',['QAM',13,'baseband/Product1']])
set_param([sys,'/',['QAM',13,'baseband/Product1']],...
		'position',[300,93,330,117])

add_block('built-in/Product',[sys,'/',['QAM',13,'baseband/Product']])
set_param([sys,'/',['QAM',13,'baseband/Product']],...
		'position',[300,33,330,57])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband/R1']])
set_param([sys,'/',['QAM',13,'baseband/R1']],...
		'position',[190,15,195,20])
add_line([sys,'/',['QAM',13,'baseband']],[410,220;425,220;425,150;465,150])
add_line([sys,'/',['QAM',13,'baseband']],[400,70;425,70;425,130;465,130])
add_line([sys,'/',['QAM',13,'baseband']],[335,45;345,45;345,65;370,65])
add_line([sys,'/',['QAM',13,'baseband']],[335,105;345,105;345,75;370,75])
add_line([sys,'/',['QAM',13,'baseband']],[120,40;295,40])
add_line([sys,'/',['QAM',13,'baseband']],[238,40;238,190;305,190])
add_line([sys,'/',['QAM',13,'baseband']],[105,155;270,155;270,50;295,50])
add_line([sys,'/',['QAM',13,'baseband']],[270,155;270,235;305,235])
add_line([sys,'/',['QAM',13,'baseband']],[155,175;280,175;280,110;295,110])
add_line([sys,'/',['QAM',13,'baseband']],[280,175;280,200;305,200])
add_line([sys,'/',['QAM',13,'baseband']],[160,65;245,65;245,100;295,100])
add_line([sys,'/',['QAM',13,'baseband']],[250,100;250,245;305,245])
add_line([sys,'/',['QAM',13,'baseband']],[345,195;355,195;355,215;380,215])
add_line([sys,'/',['QAM',13,'baseband']],[345,240;355,240;355,225;380,225])
add_line([sys,'/',['QAM',13,'baseband']],[550,140;580,140])
set_param([sys,'/',['QAM',13,'baseband']],...
		'Mask Display','plot(0,0,100,100,x,y,u,v);QAM',...
		'Mask Type','QM DSB-SC AM CE')
set_param([sys,'/',['QAM',13,'baseband']],...
		'Mask Dialogue','Modulate the in-phase and quadrature\ncomponent signal from the 1st and 2nd\ninput ports, baseband simulation.|Initial phase (rad):')
set_param([sys,'/',['QAM',13,'baseband']],...
		'Mask Translate','Ph=@1;x1=cos(Ph);x2=sin(Ph);[x,y]=moduicon(1);[u,v]=cmplxicn(1,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['QAM',13,'baseband']],...
		'Mask Help','This block outputs the complex envelope of the quadratic multiplexed double-sideband suppressed-carrier amplitude modulated signal. The 1st and 2nd input ports input the in-phase and quadrature components. The output is a complex signal.')
set_param([sys,'/',['QAM',13,'baseband']],...
		'Mask Entries','0\/')


%     Finished composite block ['QAM',13,'baseband'].

set_param([sys,'/',['QAM',13,'baseband']],...
		'ForeGround',4,...
		'position',[150,118,230,162])


%     Subsystem  ['QAM',13,'baseband1'].

new_system([sys,'/',['QAM',13,'baseband1']])
set_param([sys,'/',['QAM',13,'baseband1']],'Location',[321,500,954,793])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband1/R1']])
set_param([sys,'/',['QAM',13,'baseband1/R1']],...
		'position',[190,15,195,20])

add_block('built-in/Product',[sys,'/',['QAM',13,'baseband1/Product']])
set_param([sys,'/',['QAM',13,'baseband1/Product']],...
		'position',[300,33,330,57])

add_block('built-in/Product',[sys,'/',['QAM',13,'baseband1/Product1']])
set_param([sys,'/',['QAM',13,'baseband1/Product1']],...
		'position',[300,93,330,117])

add_block('built-in/Sum',[sys,'/',['QAM',13,'baseband1/Sum']])
set_param([sys,'/',['QAM',13,'baseband1/Sum']],...
		'inputs','+-',...
		'position',[375,60,395,80])

add_block('built-in/Note',[sys,'/',['QAM',13,'baseband1/R_out']])
set_param([sys,'/',['QAM',13,'baseband1/R_out']],...
		'position',[445,45,450,50])

add_block('built-in/Mux',[sys,'/',['QAM',13,'baseband1/RI2C']])
set_param([sys,'/',['QAM',13,'baseband1/RI2C']],...
		'inputs','2',...
		'Mask Display','Real/Imag\nto Complex',...
		'Mask Type','Real/Imag to Complex',...
		'Mask Dialogue','Construct complex vector from real and imaginary vectors.')
set_param([sys,'/',['QAM',13,'baseband1/RI2C']],...
		'Mask Help','The Real/Imag to Complex block creates a complex output from the two inputs. It uses a Mux block to append the complex part (input 2) to the real part (input 1).')
set_param([sys,'/',['QAM',13,'baseband1/RI2C']],...
		'position',[470,119,545,161])

add_block('built-in/Inport',[sys,'/',['QAM',13,'baseband1/in_1']])
set_param([sys,'/',['QAM',13,'baseband1/in_1']],...
		'position',[95,30,115,50])

add_block('built-in/Outport',[sys,'/',['QAM',13,'baseband1/out_1']])
set_param([sys,'/',['QAM',13,'baseband1/out_1']],...
		'position',[585,130,605,150])

add_block('built-in/Constant',[sys,'/',['QAM',13,'baseband1/Constant']])
set_param([sys,'/',['QAM',13,'baseband1/Constant']],...
		'Value','x1',...
		'position',[80,145,100,165])

add_block('built-in/Constant',[sys,'/',['QAM',13,'baseband1/Constant1']])
set_param([sys,'/',['QAM',13,'baseband1/Constant1']],...
		'Value','x2',...

⌨️ 快捷键说明

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