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

📄 exconvcd.m

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

add_block('built-in/Inport',[sys,'/','Inport1'])
set_param([sys,'/','Inport1'],...
		'ForeGround',3,...
		'Port','2',...
		'position',[40,85,60,105])

add_block('built-in/Memory',[sys,'/','Memory1'])
set_param([sys,'/','Memory1'],...
		'ForeGround',2,...
		'position',[170,155,210,185])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator3']])
set_param([sys,'/',['Logical',13,'Operator3']],...
		'ForeGround',4,...
		'Operator','XOR',...
		'position',[115,142,140,193])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator1']])
set_param([sys,'/',['Logical',13,'Operator1']],...
		'ForeGround',4,...
		'Operator','XOR',...
		'position',[245,132,270,183])

add_block('built-in/Logical Operator',[sys,'/',['Logical',13,'Operator2']])
set_param([sys,'/',['Logical',13,'Operator2']],...
		'ForeGround',4,...
		'Operator','XOR',...
		'Number of Input Ports','3',...
		'position',[385,120,410,170])

add_block('built-in/Outport',[sys,'/','Outport2'])
set_param([sys,'/','Outport2'],...
		'Port','3',...
		'position',[455,135,475,155])

add_block('built-in/Outport',[sys,'/','Outport1'])
set_param([sys,'/','Outport1'],...
		'Port','2',...
		'position',[450,85,470,105])

add_block('built-in/Outport',[sys,'/','Outport'])
set_param([sys,'/','Outport'],...
		'position',[445,25,465,45])

add_block('built-in/Note',[sys,'/','This is not a simulation block diagram.'])
set_param([sys,'/','This is not a simulation block diagram.'],...
		'position',[165,230,170,235])

add_block('built-in/Note',[sys,'/','This diagram is for the use of building convolution code transfer function.'])
set_param([sys,'/','This diagram is for the use of building convolution code transfer function.'],...
		'position',[260,250,265,255])
add_line(sys,[70,35;440,35])
add_line(sys,[275,160;380,160])
add_line(sys,[65,95;335,95;335,145;380,145])
add_line(sys,[200,35;200,145;240,145])
add_line(sys,[350,35;350,130;380,130])
add_line(sys,[335,95;445,95])
add_line(sys,[415,145;450,145])
add_line(sys,[145,170;165,170])
add_line(sys,[215,170;240,170])
add_line(sys,[80,95;80,155;110,155])
add_line(sys,[315,160;315,230;95,230;95,180;110,180])

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