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

📄 com_code.m

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

new_system([sys,'/','8//4'])
set_param([sys,'/','8//4'],'Location',[175,552,335,697])
set_param([sys,'/','8//4'],...
		'Mask Display','R-S\nco/dec',...
		'Mask Dialogue','eval(''comcdrs'')')


%     Finished composite block '8//4'.

set_param([sys,'/','8//4'],...
		'hide name',0,...
		'position',[205,65,285,109])


%     Subsystem  '4//2-2'.

new_system([sys,'/','4//2-2'])
set_param([sys,'/','4//2-2'],'Location',[175,552,335,697])
set_param([sys,'/','4//2-2'],...
		'Mask Display','Cyclic\nco/dec',...
		'Mask Dialogue','eval(''comcdcyc'')')


%     Finished composite block '4//2-2'.

set_param([sys,'/','4//2-2'],...
		'hide name',0,...
		'position',[300,65,380,109])


%     Subsystem  '4//2-3'.

new_system([sys,'/','4//2-3'])
set_param([sys,'/','4//2-3'],'Location',[175,552,335,697])
set_param([sys,'/','4//2-3'],...
		'Mask Display','Linear\nco/dec',...
		'Mask Dialogue','eval(''comcdlin'')')


%     Finished composite block '4//2-3'.

set_param([sys,'/','4//2-3'],...
		'hide name',0,...
		'position',[395,65,475,109])

add_block('built-in/Note',[sys,'/','Error-Control Coding//Decoding Library'])
set_param([sys,'/','Error-Control Coding//Decoding Library'],...
		'ForeGround',3,...
		'Font Weight','bold',...
		'Font Size',12,...
		'position',[280,15,285,20])


%     Subsystem  '4//2'.

new_system([sys,'/','4//2'])
set_param([sys,'/','4//2'],'Location',[175,552,335,697])
set_param([sys,'/','4//2'],...
		'Mask Display','Hamming\nco/dec',...
		'Mask Dialogue','eval(''comcdham'')')


%     Finished composite block '4//2'.

set_param([sys,'/','4//2'],...
		'hide name',0,...
		'position',[15,65,95,109])


%     Subsystem  '5//2'.

new_system([sys,'/','5//2'])
set_param([sys,'/','5//2'],'Location',[175,552,335,697])
set_param([sys,'/','5//2'],...
		'Mask Display','BCH\nco/dec',...
		'Mask Dialogue','eval(''comcdbch'')')


%     Finished composite block '5//2'.

set_param([sys,'/','5//2'],...
		'hide name',0,...
		'position',[110,65,190,109])


%     Subsystem  '5//2-2'.

new_system([sys,'/','5//2-2'])
set_param([sys,'/','5//2-2'],'Location',[175,552,335,697])
set_param([sys,'/','5//2-2'],...
		'Mask Display','Convolution\nco/dec',...
		'Mask Dialogue','eval(''comcdcon'')')


%     Finished composite block '5//2-2'.

set_param([sys,'/','5//2-2'],...
		'hide name',0,...
		'position',[490,65,570,109])

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 + -