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

📄 tutmodce.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 5 页
字号:
function [ret,x0,str,ts,xts]=tutmodce(t,x,u,flag);
%TUTMODCE	is the M-file description of the SIMULINK system named TUTMODCE.
%	The block-diagram can be displayed by typing: TUTMODCE.
%
%	SYS=TUTMODCE(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 TUTMODCE 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 TUTMODCE with a FLAG of zero:
%	[SIZES]=TUTMODCE([],[],[],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',[364,65,848,595])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-45')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '1')
set_param(sys,'Min step size', '0.01')
set_param(sys,'Max step size', '0.01')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')
set_param(sys,'Load callback','ts=.01;[num,den]=butter(2,100/pi/2*ts);');

add_block('built-in/Signal Generator',[sys,'/',['Signal',13,'generator']])
set_param([sys,'/',['Signal',13,'generator']],...
		'Peak','1.000000',...
		'Peak Range','5.000000',...
		'Freq','3.000000',...
		'Freq Range','6.000000',...
		'Wave','Sin',...
		'Units','Rads',...
		'position',[30,43,75,77])

add_block('built-in/Outport',[sys,'/','Outport3'])
set_param([sys,'/','Outport3'],...
		'ForeGround',4,...
		'Port','4',...
		'position',[365,185,385,205])

add_block('built-in/Outport',[sys,'/','Outport2'])
set_param([sys,'/','Outport2'],...
		'ForeGround',3,...
		'Port','3',...
		'position',[365,125,385,145])

add_block('built-in/Outport',[sys,'/','Outport1'])
set_param([sys,'/','Outport1'],...
		'ForeGround',2,...
		'Port','2',...
		'position',[360,50,380,70])

add_block('built-in/Outport',[sys,'/','Outport'])
set_param([sys,'/','Outport'],...
		'position',[140,5,160,25])

add_block('built-in/Outport',[sys,'/','Outport4'])
set_param([sys,'/','Outport4'],...
		'ForeGround',7,...
		'Port','5',...
		'position',[360,255,380,275])

add_block('built-in/Note',[sys,'/','Default in this simulations: ts=0.01; [num,den]=butter(2,Fc*2*ts);'])
set_param([sys,'/','Default in this simulations: ts=0.01; [num,den]=butter(2,Fc*2*ts);'],...
		'position',[255,535,260,540])

add_block('built-in/Outport',[sys,'/','Outport8'])
set_param([sys,'/','Outport8'],...
		'Port','9',...
		'position',[165,485,185,505])

add_block('built-in/Outport',[sys,'/','Outport6'])
set_param([sys,'/','Outport6'],...
		'ForeGround',5,...
		'Port','7',...
		'position',[400,420,420,440])

add_block('built-in/Outport',[sys,'/','Outport7'])
set_param([sys,'/','Outport7'],...
		'ForeGround',5,...
		'Port','8',...
		'position',[350,440,370,460])

add_block('built-in/Signal Generator',[sys,'/',['Signal',13,'generator1']])
set_param([sys,'/',['Signal',13,'generator1']],...
		'Peak','1.000000',...
		'Peak Range','5.000000',...
		'Freq','6.000000',...
		'Freq Range','6.000000',...
		'Wave','Saw',...
		'Units','Rads',...
		'position',[15,433,60,467])

add_block('built-in/Outport',[sys,'/','Outport5'])
set_param([sys,'/','Outport5'],...
		'ForeGround',6,...
		'Port','6',...
		'position',[360,325,380,345])

add_block('built-in/Demux',[sys,'/','Demux'])
set_param([sys,'/','Demux'],...
		'ForeGround',6,...
		'outputs','2',...
		'position',[330,368,385,397])

add_block('built-in/Outport',[sys,'/','Outport9'])
set_param([sys,'/','Outport9'],...
		'ForeGround',6,...
		'Port','10',...
		'position',[415,380,435,400])


%     Subsystem  ['DSB AM',13,'baseband'].

new_system([sys,'/',['DSB AM',13,'baseband']])
set_param([sys,'/',['DSB AM',13,'baseband']],'Location',[212,430,575,573])

add_block('built-in/Outport',[sys,'/',['DSB AM',13,'baseband/out_1']])
set_param([sys,'/',['DSB AM',13,'baseband/out_1']],...
		'position',[320,50,340,70])

add_block('built-in/Product',[sys,'/',['DSB AM',13,'baseband/Product']])
set_param([sys,'/',['DSB AM',13,'baseband/Product']],...
		'position',[255,42,280,73])

add_block('built-in/Inport',[sys,'/',['DSB AM',13,'baseband/in_1']])
set_param([sys,'/',['DSB AM',13,'baseband/in_1']],...
		'position',[115,15,135,35])

add_block('built-in/Mux',[sys,'/',['DSB AM',13,'baseband/Mux']])
set_param([sys,'/',['DSB AM',13,'baseband/Mux']],...
		'inputs','2',...
		'position',[170,66,205,99])

add_block('built-in/Constant',[sys,'/',['DSB AM',13,'baseband/Constant1']])
set_param([sys,'/',['DSB AM',13,'baseband/Constant1']],...
		'Value','x2',...
		'position',[90,90,110,110])

add_block('built-in/Constant',[sys,'/',['DSB AM',13,'baseband/Constant']])
set_param([sys,'/',['DSB AM',13,'baseband/Constant']],...
		'Value','x1',...
		'position',[40,65,60,85])
add_line([sys,'/',['DSB AM',13,'baseband']],[65,75;165,75])
add_line([sys,'/',['DSB AM',13,'baseband']],[115,100;130,100;130,90;165,90])
add_line([sys,'/',['DSB AM',13,'baseband']],[140,25;185,25;185,50;250,50])
add_line([sys,'/',['DSB AM',13,'baseband']],[285,60;315,60])
add_line([sys,'/',['DSB AM',13,'baseband']],[210,85;230,85;230,65;250,65])
set_param([sys,'/',['DSB AM',13,'baseband']],...
		'Mask Display','plot(0,0,100,100,x,y,u,v);DSB AM',...
		'Mask Type','DSB-SC AM CE',...
		'Mask Dialogue','Output the complex envelope of a\nDSB-SC AM modulated signal.|Initial Phase (rad):')
set_param([sys,'/',['DSB AM',13,'baseband']],...
		'Mask Translate','Ph=@1;x1=cos(Ph);x2=sin(Ph);pi2=2*pi;[x,y]=moduicon(1);[u,v]=cmplxicn(1,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['DSB AM',13,'baseband']],...
		'Mask Help','This block outputs the complex envelope of the double-sideband suppressed-carrier amplitude modulated signal. The output is a complex signal.',...
		'Mask Entries','0\/')


%     Finished composite block ['DSB AM',13,'baseband'].

set_param([sys,'/',['DSB AM',13,'baseband']],...
		'ForeGround',2,...
		'hide name',0,...
		'position',[125,38,205,82])


%     Subsystem  ['DSB-ADM',13,'baseband'].

new_system([sys,'/',['DSB-ADM',13,'baseband']])
set_param([sys,'/',['DSB-ADM',13,'baseband']],'Location',[306,370,856,591])

add_block('built-in/Filter',[sys,'/',['DSB-ADM',13,'baseband/Filter2']])
set_param([sys,'/',['DSB-ADM',13,'baseband/Filter2']],...
		'orientation',2,...
		'hide name',0,...
		'Numerator','num',...
		'Denominator','den',...
		'Sample time','ts',...
		'Mask Display','Lowpass\nfilter',...
		'position',[265,100,325,140])

add_block('built-in/Filter',[sys,'/',['DSB-ADM',13,'baseband/Filter']])
set_param([sys,'/',['DSB-ADM',13,'baseband/Filter']],...
		'hide name',0,...
		'Numerator','num',...
		'Denominator','den',...
		'Sample time','ts',...
		'Mask Display','Lowpass\nfilter',...
		'position',[215,26,270,64])

add_block('built-in/Product',[sys,'/',['DSB-ADM',13,'baseband/Product1']])
set_param([sys,'/',['DSB-ADM',13,'baseband/Product1']],...
		'orientation',2,...
		'hide name',0,...
		'position',[345,110,380,130])

add_block('built-in/Outport',[sys,'/',['DSB-ADM',13,'baseband/out_1']])
set_param([sys,'/',['DSB-ADM',13,'baseband/out_1']],...
		'position',[440,35,460,55])


%     Subsystem  ['DSB-ADM',13,'baseband/FM CE//VCO'].

new_system([sys,'/',['DSB-ADM',13,'baseband/FM CE//VCO']])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -