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

📄 fig_10_9.m

📁 数字通信第四版原书的例程
💻 M
字号:
function [ret,x0,str,ts,xts]=fig_10_9(t,x,u,flag);
%FIG_10_9	is the M-file description of the SIMULINK system named FIG_10_9.
%	The block-diagram can be displayed by typing: FIG_10_9.
%
%	SYS=FIG_10_9(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 FIG_10_9 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 FIG_10_9 with a FLAG of zero:
%	[SIZES]=FIG_10_9([],[],[],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',[448,69,1004,497])
     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,'/','Inport1'])
set_param([sys,'/','Inport1'],...
		'position',[45,25,65,45])

add_block('built-in/Outport',[sys,'/','Outport2'])
set_param([sys,'/','Outport2'],...
		'Port','2',...
		'position',[445,70,465,90])

add_block('built-in/Inport',[sys,'/','Inport2'])
set_param([sys,'/','Inport2'],...
		'ForeGround',3,...
		'Port','2',...
		'position',[40,70,60,90])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator1']])
set_param([sys,'/',['Logical',13,'Operator1']],...
		'ForeGround',4,...
		'Operator','XOR',...
		'position',[110,111,140,164])

add_block('built-in/Outport',[sys,'/','Outport3'])
set_param([sys,'/','Outport3'],...
		'Port','3',...
		'position',[490,105,510,125])

add_block('built-in/Outport',[sys,'/','Outport1'])
set_param([sys,'/','Outport1'],...
		'position',[405,25,425,45])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator3']])
set_param([sys,'/',['Logical',13,'Operator3']],...
		'ForeGround',4,...
		'Operator','XOR',...
		'Number of Input Ports','3',...
		'position',[375,90,405,140])

add_block('built-in/Memory',[sys,'/','Memory1'])
set_param([sys,'/','Memory1'],...
		'ForeGround',2,...
		'position',[160,125,200,155])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator2']])
set_param([sys,'/',['Logical',13,'Operator2']],...
		'ForeGround',4,...
		'Operator','XOR',...
		'position',[235,103,265,152])

add_block('built-in/Memory',[sys,'/','Memory2'])
set_param([sys,'/','Memory2'],...
		'ForeGround',2,...
		'position',[290,115,330,145])

add_block('built-in/Note',[sys,'/',['This model demonstrates how to build a convolutional code transfer function    ',13,'using SIMULINK block diagram. Only four different types of blocks are allowed',13,'to construct a linear convolution code block diagram:                                   ']])
set_param([sys,'/',['This model demonstrates how to build a convolutional code transfer function    ',13,'using SIMULINK block diagram. Only four different types of blocks are allowed',13,'to construct a linear convolution code block diagram:                                   ']],...
		'position',[270,200,275,205])

add_block('built-in/Note',[sys,'/',['Inport block -- input sequence.   ',13,'Outport block -- output sequence.',13,'XOR block -- modulo-2 sum.       ',13,'Memory blocks -- registers.         ']])
set_param([sys,'/',['Inport block -- input sequence.   ',13,'Outport block -- output sequence.',13,'XOR block -- modulo-2 sum.       ',13,'Memory blocks -- registers.         ']],...
		'position',[190,245,195,250])

add_block('built-in/Note',[sys,'/',['Use the MATLAB function SIM2GEN to generate the octal form of the',13,'transfer function matrix. In this example, the octal form of the transfer',13,'function is tf = [4 0 7; 0 4 5];                                                          ']])
set_param([sys,'/',['Use the MATLAB function SIM2GEN to generate the octal form of the',13,'transfer function matrix. In this example, the octal form of the transfer',13,'function is tf = [4 0 7; 0 4 5];                                                          ']],...
		'position',[245,305,250,310])

add_block('built-in/Note',[sys,'/',['At the MATLAB prompt, type connonli for a demonstration of building a nonlinear',13,'convolutional code. ']])
set_param([sys,'/',['At the MATLAB prompt, type connonli for a demonstration of building a nonlinear',13,'convolutional code. ']],...
		'position',[265,355,270,360])
add_line(sys,[70,35;400,35])
add_line(sys,[335,130;370,130])
add_line(sys,[270,130;285,130])
add_line(sys,[90,35;90,125;105,125])
add_line(sys,[65,80;335,80;335,115;370,115])
add_line(sys,[350,35;350,100;370,100])
add_line(sys,[335,80;440,80])
add_line(sys,[410,115;485,115])
add_line(sys,[80,80;80,150;105,150])
add_line(sys,[145,140;155,140])
add_line(sys,[205,140;230,140])
add_line(sys,[205,35;205,115;230,115])

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