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

📄 v34cod64.m

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

add_block('built-in/Inport',[sys,'/','In3'])
set_param([sys,'/','In3'],...
		'orientation',1,...
		'ForeGround',5,...
		'Port','3',...
		'position',[145,10,165,30])

add_block('built-in/Inport',[sys,'/','In2'])
set_param([sys,'/','In2'],...
		'orientation',1,...
		'ForeGround',4,...
		'Port','2',...
		'position',[195,10,215,30])

add_block('built-in/Inport',[sys,'/','In1'])
set_param([sys,'/','In1'],...
		'orientation',1,...
		'ForeGround',3,...
		'position',[245,10,265,30])

add_block('built-in/Outport',[sys,'/','Out4'])
set_param([sys,'/','Out4'],...
		'move name',0,...
		'Port','4',...
		'position',[820,80,840,100])

add_block('built-in/Outport',[sys,'/','Out3'])
set_param([sys,'/','Out3'],...
		'move name',0,...
		'Port','3',...
		'position',[790,60,810,80])

add_block('built-in/Outport',[sys,'/','Out2'])
set_param([sys,'/','Out2'],...
		'move name',0,...
		'Port','2',...
		'position',[755,45,775,65])

add_block('built-in/Outport',[sys,'/','Out1'])
set_param([sys,'/','Out1'],...
		'move name',0,...
		'position',[720,30,740,50])

add_block('built-in/Note',[sys,'/','V.34 64 state convolution encoder'])
set_param([sys,'/','V.34 64 state convolution encoder'],...
		'position',[355,255,360,260])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator9']])
set_param([sys,'/',['Logical',13,'Operator9']],...
		'orientation',2,...
		'ForeGround',6,...
		'hide name',0,...
		'Operator','AND',...
		'position',[220,97,255,128])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator7']])
set_param([sys,'/',['Logical',13,'Operator7']],...
		'orientation',2,...
		'hide name',0,...
		'Operator','AND',...
		'position',[220,132,255,163])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator6']])
set_param([sys,'/',['Logical',13,'Operator6']],...
		'orientation',2,...
		'hide name',0,...
		'Operator','XOR',...
		'Number of Input Ports','3',...
		'position',[30,133,65,167])

add_block('built-in/Unit Delay',[sys,'/','Unit Delay4'])
set_param([sys,'/','Unit Delay4'],...
		'ForeGround',4,...
		'hide name',0,...
		'position',[530,185,560,215])

add_block('built-in/Unit Delay',[sys,'/','Unit Delay3'])
set_param([sys,'/','Unit Delay3'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[450,185,485,215])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator4']])
set_param([sys,'/',['Logical',13,'Operator4']],...
		'hide name',0,...
		'Operator','XOR',...
		'position',[385,182,420,213])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator3']])
set_param([sys,'/',['Logical',13,'Operator3']],...
		'hide name',0,...
		'Operator','XOR',...
		'position',[305,170,340,205])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator1']])
set_param([sys,'/',['Logical',13,'Operator1']],...
		'hide name',0,...
		'Operator','XOR',...
		'position',[95,180,125,215])

add_block('built-in/Unit Delay',[sys,'/','Unit Delay1'])
set_param([sys,'/','Unit Delay1'],...
		'hide name',0,...
		'position',[30,175,65,205])

add_block('built-in/Unit Delay',[sys,'/','Unit Delay2'])
set_param([sys,'/','Unit Delay2'],...
		'hide name',0,...
		'position',[235,180,265,210])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator2']])
set_param([sys,'/',['Logical',13,'Operator2']],...
		'hide name',0,...
		'Operator','XOR',...
		'Number of Input Ports','4',...
		'position',[180,171,210,219])

add_block('built-in/Unit Delay',[sys,'/','Unit Delay5'])
set_param([sys,'/','Unit Delay5'],...
		'hide name',0,...
		'position',[670,194,700,226])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator5']])
set_param([sys,'/',['Logical',13,'Operator5']],...
		'hide name',0,...
		'Operator','XOR',...
		'position',[615,192,650,223])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator8']])
set_param([sys,'/',['Logical',13,'Operator8']],...
		'hide name',0,...
		'Operator','XOR',...
		'Number of Input Ports','3',...
		'position',[735,193,765,227])

add_block('built-in/Unit Delay',[sys,'/','Unit Delay6'])
set_param([sys,'/','Unit Delay6'],...
		'hide name',0,...
		'position',[785,196,820,224])

add_block('built-in/Outport',[sys,'/','Out5'])
set_param([sys,'/','Out5'],...
		'move name',0,...
		'Port','5',...
		'position',[855,200,875,220])
add_line(sys,[70,190;90,190])
add_line(sys,[215,195;230,195])
add_line(sys,[425,200;445,200])
add_line(sys,[655,210;665,210])
add_line(sys,[255,35;255,40;715,40])
add_line(sys,[205,35;205,55;750,55])
add_line(sys,[155,35;155,70;785,70])
add_line(sys,[25,150;15,150;25,190])
add_line(sys,[105,35;105,140;70,140])
add_line(sys,[270,195;280,195;280,230;75,230;75,205;90,205])
add_line(sys,[130,200;145,200;145,160;70,160])
add_line(sys,[215,150;70,150])
add_line(sys,[770,210;780,210])
add_line(sys,[705,210;730,210])
add_line(sys,[565,200;575,200;575,245;155,245;155,210;175,210])
add_line(sys,[105,90;815,90])
add_line(sys,[215,115;165,115;175,180])
add_line(sys,[155,70;155,190;175,190])
add_line(sys,[145,200;175,200])
add_line(sys,[270,55;260,105])
add_line(sys,[280,195;300,195])
add_line(sys,[285,40;285,180;300,180])
add_line(sys,[345,190;365,190;365,155;260,155])
add_line(sys,[365,190;380,190])
add_line(sys,[490,200;500,200;500,140;260,140])
add_line(sys,[500,140;500,120;260,120])
add_line(sys,[500,200;525,200])
add_line(sys,[500,200;500,230;360,230;360,205;380,205])
add_line(sys,[825,210;835,210;835,245;595,245;595,215;610,215])
add_line(sys,[575,200;610,200])
add_line(sys,[500,230;715,230;715,220;730,220])
add_line(sys,[710,55;710,200;730,200])
add_line(sys,[835,210;850,210])

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