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

📄 v34cod16.m

📁 数字通信第四版原书的例程
💻 M
字号:
function [ret,x0,str,ts,xts]=v34cod16(t,x,u,flag);
%V34COD16	is the M-file description of the SIMULINK system named V34COD16.
%	The block-diagram can be displayed by typing: V34COD16.
%
%	SYS=V34COD16(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 V34COD16 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 V34COD16 with a FLAG of zero:
%	[SIZES]=V34COD16([],[],[],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',[277,54,1018,228])
     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/Inport',[sys,'/','In2'])
set_param([sys,'/','In2'],...
		'orientation',1,...
		'ForeGround',3,...
		'Port','2',...
		'position',[95,10,115,30])

add_block('built-in/Outport',[sys,'/','Out1'])
set_param([sys,'/','Out1'],...
		'move name',0,...
		'position',[565,35,585,55])

add_block('built-in/Inport',[sys,'/','In1'])
set_param([sys,'/','In1'],...
		'orientation',1,...
		'position',[150,10,170,30])

add_block('built-in/Outport',[sys,'/','Out2'])
set_param([sys,'/','Out2'],...
		'move name',0,...
		'Port','2',...
		'position',[615,50,635,70])

add_block('built-in/Outport',[sys,'/','Out3'])
set_param([sys,'/','Out3'],...
		'move name',0,...
		'Port','3',...
		'position',[650,80,670,100])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator1']])
set_param([sys,'/',['Logical',13,'Operator1']],...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','XOR',...
		'position',[295,70,330,110])

add_block('built-in/Memory',[sys,'/','Memory3'])
set_param([sys,'/','Memory3'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[530,75,570,105])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator2']])
set_param([sys,'/',['Logical',13,'Operator2']],...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','XOR',...
		'position',[460,70,495,110])

add_block('built-in/Memory',[sys,'/','Memory2'])
set_param([sys,'/','Memory2'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[365,75,405,105])

add_block('built-in/Memory',[sys,'/','Memory1'])
set_param([sys,'/','Memory1'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[205,75,245,105])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator']])
set_param([sys,'/',['Logical',13,'Operator']],...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','XOR',...
		'Number of Input Ports','3',...
		'position',[130,70,165,110])

add_block('built-in/Memory',[sys,'/','Memory'])
set_param([sys,'/','Memory'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[35,75,75,105])

add_block('built-in/Note',[sys,'/','V.34 16 state convolution encoder'])
set_param([sys,'/','V.34 16 state convolution encoder'],...
		'position',[310,140,315,145])
add_line(sys,[160,35;160,45;560,45])
add_line(sys,[105,35;105,60;610,60])
add_line(sys,[80,90;125,90])
add_line(sys,[170,90;200,90])
add_line(sys,[250,90;265,90;265,100;290,100])
add_line(sys,[265,60;265,80;290,80])
add_line(sys,[335,90;360,90])
add_line(sys,[575,90;645,90])
add_line(sys,[410,90;425,90;425,100;455,100])
add_line(sys,[500,90;525,90])
add_line(sys,[425,45;425,80;455,80])
add_line(sys,[585,90;585,130;15,130;15,90;30,90])
add_line(sys,[100,130;100,105;125,105])
add_line(sys,[105,60;105,75;125,75])

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