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

📄 com_case.m

📁 数字通信第四版原书的例程
💻 M
字号:
function [ret,x0,str,ts,xts]=com_case(t,x,u,flag);
%COM_CASE	is the M-file description of the SIMULINK system named COM_CASE.
%	The block-diagram can be displayed by typing: COM_CASE.
%
%	SYS=COM_CASE(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 COM_CASE 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 COM_CASE with a FLAG of zero:
%	[SIZES]=COM_CASE([],[],[],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',[4,83,602,240])
     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',   '')


%     Subsystem  'Utility3'.

new_system([sys,'/','Utility3'])
set_param([sys,'/','Utility3'],'Location',[136,230,381,439])
set_param([sys,'/','Utility3'],...
		'Mask Display','Bit-error\nrate\ncomputation',...
		'Mask Dialogue','eval(''commgui;'')')


%     Finished composite block 'Utility3'.

set_param([sys,'/','Utility3'],...
		'BackGround',7,...
		'hide name',0,...
		'position',[35,76,115,120])


%     Subsystem  ['Vector convolution',13,'co//dec demo'].

new_system([sys,'/',['Vector convolution',13,'co//dec demo']])
set_param([sys,'/',['Vector convolution',13,'co//dec demo']],'Location',[175,552,335,697])
set_param([sys,'/',['Vector convolution',13,'co//dec demo']],...
		'Mask Display','Unbergoeck\nTCM\ndemo',...
		'Mask Dialogue','eval(''ungerboe;tf=sim2tran(''''ungerboe'''');N_con_demo=tf(1,size(tf,2));K_con_demo=tf(2,size(tf,2));viterunb'')')


%     Finished composite block ['Vector convolution',13,'co//dec demo'].

set_param([sys,'/',['Vector convolution',13,'co//dec demo']],...
		'BackGround',7,...
		'hide name',0,...
		'position',[380,76,460,120])


%     Subsystem  ['Vector convolution',13,'co//dec demo2'].

new_system([sys,'/',['Vector convolution',13,'co//dec demo2']])
set_param([sys,'/',['Vector convolution',13,'co//dec demo2']],'Location',[175,552,335,697])
set_param([sys,'/',['Vector convolution',13,'co//dec demo2']],...
		'Mask Display','V.34\ndata\ntranslation')
set_param([sys,'/',['Vector convolution',13,'co//dec demo2']],...
		'Mask Dialogue','eval(''v34cod16;BRATE=28800;SRATE=3200;CON_CODE=1;v34_plot_flag=0;v34_rate_b = 72; v34_rate_p=7;v34_rate_j=16;v34struc;'')')


%     Finished composite block ['Vector convolution',13,'co//dec demo2'].

set_param([sys,'/',['Vector convolution',13,'co//dec demo2']],...
		'BackGround',7,...
		'hide name',0,...
		'position',[495,76,575,120])

add_block('built-in/Note',[sys,'/',' Examples'])
set_param([sys,'/',' Examples'],...
		'ForeGround',3,...
		'Font Weight','bold',...
		'Font Size',12,...
		'position',[285,25,290,30])


%     Subsystem  'Utility1'.

new_system([sys,'/','Utility1'])
set_param([sys,'/','Utility1'],'Location',[136,230,381,439])
set_param([sys,'/','Utility1'],...
		'Mask Display','E-L gate\ndemo')
set_param([sys,'/','Utility1'],...
		'Mask Dialogue','eval(''tss=1/12000;tdd=1/600;MM=2;Fc=1200;Fshift=1200;[f1num,f1den]=butter(4,2*pi*4000,''''s'''');f2num=fir1(127,(Fshift/2+1/tdd)*2*tss);f2den=[1,zeros(1,127)];elg;'')')


%     Finished composite block 'Utility1'.

set_param([sys,'/','Utility1'],...
		'BackGround',7,...
		'hide name',0,...
		'position',[265,76,345,120])


%     Subsystem  'Utility2'.

new_system([sys,'/','Utility2'])
set_param([sys,'/','Utility2'],'Location',[136,230,381,439])
set_param([sys,'/','Utility2'],...
		'Mask Display','HDSL\ndemo',...
		'Mask Dialogue','eval(''com_clos;hdslsimu;'')')


%     Finished composite block 'Utility2'.

set_param([sys,'/','Utility2'],...
		'BackGround',7,...
		'hide name',0,...
		'position',[150,76,230,120])

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