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

📄 v34cod32.m

📁 数字通信第四版原书的例程
💻 M
字号:
function [ret,x0,str,ts,xts]=v34cod32(t,x,u,flag);
%V34COD32	is the M-file description of the SIMULINK system named V34COD32.
%	The block-diagram can be displayed by typing: V34COD32.
%
%	SYS=V34COD32(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 V34COD32 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 V34COD32 with a FLAG of zero:
%	[SIZES]=V34COD32([],[],[],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',[47,330,889,551])
     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/Outport',[sys,'/','Out1'])
set_param([sys,'/','Out1'],...
		'move name',0,...
		'position',[610,50,630,70])

add_block('built-in/Inport',[sys,'/','In2'])
set_param([sys,'/','In2'],...
		'orientation',1,...
		'ForeGround',3,...
		'Port','2',...
		'position',[115,25,135,45])

add_block('built-in/Inport',[sys,'/','In1'])
set_param([sys,'/','In1'],...
		'orientation',1,...
		'position',[165,25,185,45])

add_block('built-in/Inport',[sys,'/','In3'])
set_param([sys,'/','In3'],...
		'orientation',1,...
		'ForeGround',5,...
		'Port','3',...
		'position',[70,25,90,45])

add_block('built-in/Inport',[sys,'/','In4'])
set_param([sys,'/','In4'],...
		'orientation',1,...
		'ForeGround',6,...
		'Port','4',...
		'position',[25,25,45,45])

add_block('built-in/Outport',[sys,'/','Out2'])
set_param([sys,'/','Out2'],...
		'move name',0,...
		'Port','2',...
		'position',[660,65,680,85])

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

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator']])
set_param([sys,'/',['Logical',13,'Operator']],...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','XOR',...
		'position',[155,120,190,160])

add_block('built-in/Memory',[sys,'/','Memory1'])
set_param([sys,'/','Memory1'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[230,125,270,155])

add_block('built-in/Memory',[sys,'/','Memory3'])
set_param([sys,'/','Memory3'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[525,125,565,155])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator2']])
set_param([sys,'/',['Logical',13,'Operator2']],...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','XOR',...
		'position',[455,120,490,160])

add_block('built-in/Memory',[sys,'/','Memory4'])
set_param([sys,'/','Memory4'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[685,125,725,155])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator3']])
set_param([sys,'/',['Logical',13,'Operator3']],...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','XOR',...
		'position',[615,120,650,160])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator1']])
set_param([sys,'/',['Logical',13,'Operator1']],...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','XOR',...
		'position',[315,120,350,160])

add_block('built-in/Memory',[sys,'/','Memory2'])
set_param([sys,'/','Memory2'],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[380,125,420,155])

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

add_block('built-in/Outport',[sys,'/','Out5'])
set_param([sys,'/','Out5'],...
		'move name',0,...
		'Port','5',...
		'position',[800,130,820,150])

add_block('built-in/Outport',[sys,'/','Out4'])
set_param([sys,'/','Out4'],...
		'move name',0,...
		'Port','4',...
		'position',[755,95,775,115])

add_block('built-in/Note',[sys,'/','V.34 32 state convolution encoder'])
set_param([sys,'/','V.34 32 state convolution encoder'],...
		'position',[365,185,370,190])
add_line(sys,[495,140;520,140])
add_line(sys,[355,140;375,140])
add_line(sys,[195,140;225,140])
add_line(sys,[110,135;125,135;125,150;150,150])
add_line(sys,[125,50;125,75;655,75])
add_line(sys,[175,50;175,60;605,60])
add_line(sys,[80,50;80,90;705,90])
add_line(sys,[655,140;680,140])
add_line(sys,[425,140;430,140;430,150;450,150])
add_line(sys,[35,50;35,105;750,105])
add_line(sys,[730,140;740,140;740,180;45,180;45,135;60,135])
add_line(sys,[275,140;290,140;290,150;310,150])
add_line(sys,[570,140;585,140;585,150;610,150])
add_line(sys,[740,140;795,140])
add_line(sys,[595,75;595,130;610,130])
add_line(sys,[435,105;435,130;450,130])
add_line(sys,[290,60;290,130;310,130])
add_line(sys,[125,75;125,130;150,130])

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