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

📄 com_modu.m

📁 数字通信第四版原书的例程
💻 M
字号:
function [ret,x0,str,ts,xts]=com_modu(t,x,u,flag);
%COM_MODU	is the M-file description of the SIMULINK system named COM_MODU.
%	The block-diagram can be displayed by typing: COM_MODU.
%
%	SYS=COM_MODU(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_MODU 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_MODU with a FLAG of zero:
%	[SIZES]=COM_MODU([],[],[],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',[127,146,426,527])
     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',   '')

add_block('built-in/Note',[sys,'/','baseband'])
set_param([sys,'/','baseband'],...
		'ForeGround',2,...
		'position',[195,40,200,45])

add_block('built-in/Note',[sys,'/','passband'])
set_param([sys,'/','passband'],...
		'ForeGround',6,...
		'position',[75,40,80,45])

add_block('built-in/Note',[sys,'/','Modulation//Demodulation Library'])
set_param([sys,'/','Modulation//Demodulation Library'],...
		'ForeGround',3,...
		'Font Weight','bold',...
		'Font Size',12,...
		'position',[145,5,150,10])


%     Subsystem  '13////6'.

new_system([sys,'/','13////6'])
set_param([sys,'/','13////6'],'Location',[657,455,963,648])
set_param([sys,'/','13////6'],...
		'Mask Display','Digital\nmo/dem\ncmplx env',...
		'Mask Dialogue','eval(''com_clos;com_moce;'')')


%     Finished composite block '13////6'.

set_param([sys,'/','13////6'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[155,175,240,225])


%     Subsystem  '13//6'.

new_system([sys,'/','13//6'])
set_param([sys,'/','13//6'],'Location',[657,455,963,648])
set_param([sys,'/','13//6'],...
		'Mask Display','Digital\nmo/dem',...
		'Mask Dialogue','eval(''com_clos;com_ddmo;'')')


%     Finished composite block '13//6'.

set_param([sys,'/','13//6'],...
		'ForeGround',6,...
		'hide name',0,...
		'position',[35,175,120,225])

add_block('built-in/Note',[sys,'/','Digital Mo//Dem:'])
set_param([sys,'/','Digital Mo//Dem:'],...
		'position',[135,145,140,150])


%     Subsystem  '12//6'.

new_system([sys,'/','12//6'])
set_param([sys,'/','12//6'],'Location',[732,573,972,643])
set_param([sys,'/','12//6'],...
		'Mask Display','Analog\nmo/dem',...
		'Mask Dialogue','eval(''com_clos;com_cdmo;'');')


%     Finished composite block '12//6'.

set_param([sys,'/','12//6'],...
		'ForeGround',6,...
		'hide name',0,...
		'position',[35,90,120,140])


%     Subsystem  '12////6'.

new_system([sys,'/','12////6'])
set_param([sys,'/','12////6'],'Location',[657,455,963,648])
set_param([sys,'/','12////6'],...
		'Mask Display','Analog\nmo/dem\ncmplx env',...
		'Mask Dialogue','eval(''com_clos;com_cemo;'')')


%     Finished composite block '12////6'.

set_param([sys,'/','12////6'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[155,90,240,140])

add_block('built-in/Note',[sys,'/','Analog Mo//Dem:'])
set_param([sys,'/','Analog Mo//Dem:'],...
		'position',[135,60,140,65])


%     Subsystem  '13////////6'.

new_system([sys,'/','13////////6'])
set_param([sys,'/','13////////6'],'Location',[657,455,963,648])
set_param([sys,'/','13////////6'],...
		'Mask Display','Digital\nmo/dem-ce\nmap/demap',...
		'Mask Dialogue','eval(''com_clos;com_momp;'')')


%     Finished composite block '13////////6'.

set_param([sys,'/','13////////6'],...
		'ForeGround',4,...
		'hide name',0,...
		'position',[155,265,240,315])


%     Subsystem  '13//////6'.

new_system([sys,'/','13//////6'])
set_param([sys,'/','13//////6'],'Location',[657,455,963,648])
set_param([sys,'/','13//////6'],...
		'Mask Display','Digital\nmo/dem\nmap/demap',...
		'Mask Dialogue','eval(''com_clos;com_mocd;'')')


%     Finished composite block '13//////6'.

set_param([sys,'/','13//////6'],...
		'ForeGround',4,...
		'hide name',0,...
		'position',[35,265,120,315])

add_block('built-in/Note',[sys,'/','Separated Version for Digital Mo//Dem:'])
set_param([sys,'/','Separated Version for Digital Mo//Dem:'],...
		'ForeGround',4,...
		'position',[145,235,150,240])

add_block('built-in/Note',[sys,'/','Digital Modulation = map+modulation '])
set_param([sys,'/','Digital Modulation = map+modulation '],...
		'ForeGround',4,...
		'position',[135,355,140,360])

add_block('built-in/Note',[sys,'/','Digital Demodulation = demodulation+demap'])
set_param([sys,'/','Digital Demodulation = demodulation+demap'],...
		'ForeGround',4,...
		'position',[155,335,160,340])

add_block('built-in/Note',[sys,'/','Note:'])
set_param([sys,'/','Note:'],...
		'ForeGround',4,...
		'position',[40,315,45,320])

drawnow

% Return any arguments.
if (nargin | nargout)
	% Must use feval here to access system in memory
	if (nargin > 3)
		if (flag == 0)
			eval(['[ret,x0,str,ts,xts]=',sys,'(t,x,u,flag);'])
		else
			eval(['ret =', sys,'(t,x,u,flag);'])
		end
	else
		[ret,x0,str,ts,xts] = feval(sys);
	end
else
	drawnow % Flash up the model and execute load callback
end

⌨️ 快捷键说明

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