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

📄 connonli.m

📁 数字通信第四版原书的例程
💻 M
字号:
function [ret,x0,str,ts,xts]=connonli(t,x,u,flag);
%CONNONLI	is the M-file description of the SIMULINK system named CONNONLI.
%	CONNONLI has a the following characteristics:
%		0 continuous states
%		3 discrete states
%		3 outputs
%		2 inputs
%		has direct feedthrough
%		1 sample times
%
%	The block-diagram can be displayed by typing: CONNONLI.
%
%	SYS=CONNONLI(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 CONNONLI 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 CONNONLI with a FLAG of zero:
%	[SIZES]=CONNONLI([],[],[],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',[93,191,726,606])
     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/Unit Delay',[sys,'/','Unit Delay2'])
set_param([sys,'/','Unit Delay2'],...
		'orientation',2,...
		'position',[180,215,230,235])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator3']])
set_param([sys,'/',['Logical',13,'Operator3']],...
		'orientation',2,...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','AND',...
		'position',[180,165,230,200])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator4']])
set_param([sys,'/',['Logical',13,'Operator4']],...
		'orientation',2,...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','AND',...
		'position',[385,165,435,200])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator2']])
set_param([sys,'/',['Logical',13,'Operator2']],...
		'ForeGround',4,...
		'hide name',0,...
		'Operator','XOR',...
		'position',[390,115,435,150])

add_block('built-in/Unit Delay',[sys,'/','Unit Delay3'])
set_param([sys,'/','Unit Delay3'],...
		'position',[480,127,530,143])

add_block('built-in/Outport',[sys,'/','Outport3'])
set_param([sys,'/','Outport3'],...
		'Port','3',...
		'position',[585,125,605,145])

add_block('built-in/Unit Delay',[sys,'/','Unit Delay1'])
set_param([sys,'/','Unit Delay1'],...
		'position',[175,122,225,138])

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','4',...
		'position',[110,100,145,155])

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

add_block('built-in/Inport',[sys,'/','Inport2'])
set_param([sys,'/','Inport2'],...
		'ForeGround',3,...
		'Port','2',...
		'position',[25,60,45,80])

add_block('built-in/Outport',[sys,'/','Outport2'])
set_param([sys,'/','Outport2'],...
		'Port','2',...
		'position',[590,60,610,80])

add_block('built-in/Note',[sys,'/',['This model demonstrates how to build a convolutional code nonlinear',13,'transfer function using SIMULINK block diagram. The key blocks       ',13,'to construct a nonlinear convolution code block diagram are:             ']])
set_param([sys,'/',['This model demonstrates how to build a convolutional code nonlinear',13,'transfer function using SIMULINK block diagram. The key blocks       ',13,'to construct a nonlinear convolution code block diagram are:             ']],...
		'position',[255,245,260,250])

add_block('built-in/Note',[sys,'/',['Inport block -- input sequence.   ',13,'Outport block -- output sequence.',13,'Unit delay blocks -- registers.      ']])
set_param([sys,'/',['Inport block -- input sequence.   ',13,'Outport block -- output sequence.',13,'Unit delay blocks -- registers.      ']],...
		'position',[210,290,215,295])

add_block('built-in/Inport',[sys,'/','Inport1'])
set_param([sys,'/','Inport1'],...
		'position',[15,15,35,35])

add_block('built-in/Outport',[sys,'/','Outport1'])
set_param([sys,'/','Outport1'],...
		'position',[540,15,560,35])

add_block('built-in/Note',[sys,'/','Use the MATLAB function SIM2TRAN to generate the transfer function.'])
set_param([sys,'/','Use the MATLAB function SIM2TRAN to generate the transfer function.'],...
		'position',[255,340,260,345])

add_block('built-in/Note',[sys,'/',['At the MATLAB prompt, type fig_10_9 for a demonstration of building a linear',13,'convolutional code. ']])
set_param([sys,'/',['At the MATLAB prompt, type fig_10_9 for a demonstration of building a linear',13,'convolutional code. ']],...
		'position',[275,360,280,365])
add_line(sys,[50,70;585,70])
add_line(sys,[40,25;535,25])
add_line(sys,[75,25;75,105;105,105])
add_line(sys,[50,70;60,70;60,120;105,120])
add_line(sys,[440,135;475,135])
add_line(sys,[535,135;580,135])
add_line(sys,[175,225;45,225;45,135;105,135])
add_line(sys,[150,130;170,130])
add_line(sys,[230,130;265,130])
add_line(sys,[240,25;240,115;265,115])
add_line(sys,[320,125;385,125])
add_line(sys,[175,185;85,185;85,150;105,150])
add_line(sys,[330,125;330,175;235,175])
add_line(sys,[380,185;365,185;365,140;385,140])
add_line(sys,[460,70;460,175;440,175])
add_line(sys,[550,135;550,225;235,225])
add_line(sys,[550,190;440,190])
add_line(sys,[295,225;295,190;235,190])

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