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

📄 communct.m

📁 通信系统的matlab仿真程序
💻 M
字号:
function [ret,x0,str,ts,xts]=communct(t,x,u,flag);
%COMMUNCT	is the M-file description of the SIMULINK system named COMMUNCT.
%	The block-diagram can be displayed by typing: COMMUNCT.
%
%	SYS=COMMUNCT(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 COMMUNCT 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 COMMUNCT with a FLAG of zero:
%	[SIZES]=COMMUNCT([],[],[],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',[72,445,850,612])
     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  ['Source',13,'co//dec'].

new_system([sys,'/',['Source',13,'co//dec']])
set_param([sys,'/',['Source',13,'co//dec']],'Location',[196,122,458,241])
set_param([sys,'/',['Source',13,'co//dec']],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_frmt;'')')


%     Finished composite block ['Source',13,'co//dec'].

set_param([sys,'/',['Source',13,'co//dec']],...
		'position',[90,62,120,112])


%     Subsystem  'Tutorial'.

new_system([sys,'/','Tutorial'])
set_param([sys,'/','Tutorial'],'Location',[237,616,1043,890])

add_block('built-in/Note',[sys,'/',['Tutorial/This library contains transmitter and receiver. The receiving part is almost reverse of the transmitting part. For a clear',13,'relationshipe, when a transmitter block is clicked, the function for the receiving will also be shown up and vice verse.            ']])
set_param([sys,'/',['Tutorial/This library contains transmitter and receiver. The receiving part is almost reverse of the transmitting part. For a clear',13,'relationshipe, when a transmitter block is clicked, the function for the receiving will also be shown up and vice verse.            ']],...
		'position',[380,40,385,45])

add_block('built-in/Note',[sys,'/',['Tutorial/black+blue blocks => typical ANALOG communication system.                          ',13,'',13,'black+green blocks => minimum configuration of a DIGITAL communication system.',13,'',13,'black+green+red blocks => maximum configuration of a DIGITAL communication system.      ']])
set_param([sys,'/',['Tutorial/black+blue blocks => typical ANALOG communication system.                          ',13,'',13,'black+green blocks => minimum configuration of a DIGITAL communication system.',13,'',13,'black+green+red blocks => maximum configuration of a DIGITAL communication system.      ']],...
		'position',[335,115,340,120])

add_block('built-in/Note',[sys,'/','Tutorial/The transmitting blocks has orientation from left to right. The receiving blocks has orientation from right to left.'])
set_param([sys,'/','Tutorial/The transmitting blocks has orientation from left to right. The receiving blocks has orientation from right to left.'],...
		'position',[350,80,355,85])
set_param([sys,'/','Tutorial'],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_pres'')')


%     Finished composite block 'Tutorial'.

set_param([sys,'/','Tutorial'],...
		'position',[720,62,750,112])


%     Subsystem  ['Error-control',13,'co//dec'].

new_system([sys,'/',['Error-control',13,'co//dec']])
set_param([sys,'/',['Error-control',13,'co//dec']],'Location',[474,259,732,444])
set_param([sys,'/',['Error-control',13,'co//dec']],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_code;'');')


%     Finished composite block ['Error-control',13,'co//dec'].

set_param([sys,'/',['Error-control',13,'co//dec']],...
		'position',[160,62,190,112])


%     Subsystem  'Mo//dem'.

new_system([sys,'/','Mo//dem'])
set_param([sys,'/','Mo//dem'],'Location',[56,131,246,209])
set_param([sys,'/','Mo//dem'],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_modu;'')')


%     Finished composite block 'Mo//dem'.

set_param([sys,'/','Mo//dem'],...
		'position',[230,62,260,112])


%     Subsystem  ['Special',13,'filter'].

new_system([sys,'/',['Special',13,'filter']])
set_param([sys,'/',['Special',13,'filter']],'Location',[126,473,408,606])
set_param([sys,'/',['Special',13,'filter']],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_filt;'')')


%     Finished composite block ['Special',13,'filter'].

set_param([sys,'/',['Special',13,'filter']],...
		'position',[370,62,400,112])


%     Subsystem  ['Multiple',13,'access'].

new_system([sys,'/',['Multiple',13,'access']])
set_param([sys,'/',['Multiple',13,'access']],'Location',[165,401,464,518])
set_param([sys,'/',['Multiple',13,'access']],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_mlac;'')')


%     Finished composite block ['Multiple',13,'access'].

set_param([sys,'/',['Multiple',13,'access']],...
		'position',[300,62,330,112])


%     Subsystem  'Channel'.

new_system([sys,'/','Channel'])
set_param([sys,'/','Channel'],'Location',[425,298,1004,565])
set_param([sys,'/','Channel'],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_chan;'')')


%     Finished composite block 'Channel'.

set_param([sys,'/','Channel'],...
		'position',[440,62,470,112])


%     Subsystem  ['Synchroni-',13,'zation'].

new_system([sys,'/',['Synchroni-',13,'zation']])
set_param([sys,'/',['Synchroni-',13,'zation']],'Location',[618,158,867,453])
set_param([sys,'/',['Synchroni-',13,'zation']],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_clos;com_sync;'')')


%     Finished composite block ['Synchroni-',13,'zation'].

set_param([sys,'/',['Synchroni-',13,'zation']],...
		'position',[510,62,540,112])


%     Subsystem  ['Utility',13,'//misc'].

new_system([sys,'/',['Utility',13,'//misc']])
set_param([sys,'/',['Utility',13,'//misc']],'Location',[136,230,381,439])
set_param([sys,'/',['Utility',13,'//misc']],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_clos;com_util;'')')


%     Finished composite block ['Utility',13,'//misc'].

set_param([sys,'/',['Utility',13,'//misc']],...
		'position',[580,62,610,112])


%     Subsystem  'Demo'.

new_system([sys,'/','Demo'])
set_param([sys,'/','Demo'],'Location',[136,230,381,439])
set_param([sys,'/','Demo'],...
		'Mask Display','',...
		'Mask Dialogue','eval(''com_clos;comtest;'')')


%     Finished composite block 'Demo'.

set_param([sys,'/','Demo'],...
		'position',[650,62,680,112])


%     Subsystem  'Source'.

new_system([sys,'/','Source'])
set_param([sys,'/','Source'],'Location',[185,105,363,240])
set_param([sys,'/','Source'],...
		'Mask Display','',...
		'Mask Type','Source',...
		'Mask Dialogue','eval(''com_sour;'')')


%     Finished composite block 'Source'.

set_param([sys,'/','Source'],...
		'position',[20,62,50,112])

add_block('built-in/Note',[sys,'/','COMMUNICATIONS TOOLBOX SIMULINK BLOCK LIBRARY'])
set_param([sys,'/','COMMUNICATIONS TOOLBOX SIMULINK BLOCK LIBRARY'],...
		'ForeGround',2,...
		'Font Name','times',...
		'Font Weight','bold',...
		'Font Angle','italic',...
		'Font Size',14,...
		'position',[370,10,375,15])

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