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

📄 tceps2c2.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 4 页
字号:
function [ret,x0,str,ts,xts]=tceps2c2(t,x,u,flag);
%TCEPS2C2	is the M-file description of the SIMULINK system named TCEPS2C2.
%	The block-diagram can be displayed by typing: TCEPS2C2.
%
%	SYS=TCEPS2C2(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 TCEPS2C2 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 TCEPS2C2 with a FLAG of zero:
%	[SIZES]=TCEPS2C2([],[],[],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',[142,242,766,407])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-45')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '999')
set_param(sys,'Min step size', 'ts')
set_param(sys,'Max step size', 'ts')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')
set_param(sys,'Load callback','ts=.01;td=.2;Fc=100/2/pi;NIR=[6 12 18 24 30 38];AIR=[1 1.93 2.88 3.83 4.78 6.05];PIR=zeros(1,6);[num,den]=butter(4,100/pi*ts);M=sum(NIR);');


%     Subsystem  ['C-map QASK',13,'mod baseband'].

new_system([sys,'/',['C-map QASK',13,'mod baseband']])
set_param([sys,'/',['C-map QASK',13,'mod baseband']],'Location',[20,563,362,664])


%     Subsystem  ['C-map QASK',13,'mod baseband/QAM',13,'baseband1'].

new_system([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],'Location',[321,500,954,793])

add_block('built-in/Note',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Ref: Hambley: An Intro to Comm. Systems. pp72']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Ref: Hambley: An Intro to Comm. Systems. pp72']],...
		'position',[260,370,265,375])

add_block('built-in/Note',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/I_out']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/I_out']],...
		'position',[445,206,450,211])

add_block('built-in/Sum',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Sum1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Sum1']],...
		'position',[385,210,405,230])

add_block('built-in/Product',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Product2']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Product2']],...
		'position',[310,228,340,252])

add_block('built-in/Product',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Product3']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Product3']],...
		'position',[310,183,340,207])

add_block('built-in/Note',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/I2']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/I2']],...
		'position',[190,155,195,160])

add_block('built-in/Note',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/R2']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/R2']],...
		'position',[125,135,130,140])

add_block('built-in/Inport',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/in_2']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/in_2']],...
		'Port','2',...
		'position',[135,55,155,75])

add_block('built-in/Note',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/I1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/I1']],...
		'position',[193,43,198,48])

add_block('built-in/Constant',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Constant1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Constant1']],...
		'Value','x2',...
		'position',[130,165,150,185])

add_block('built-in/Constant',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Constant']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Constant']],...
		'Value','x1',...
		'position',[80,145,100,165])

add_block('built-in/Outport',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/out_1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/out_1']],...
		'position',[585,130,605,150])

add_block('built-in/Inport',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/in_1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/in_1']],...
		'position',[95,30,115,50])

add_block('built-in/Mux',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/RI2C']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/RI2C']],...
		'inputs','2',...
		'Mask Display','Real/Imag\nto Complex',...
		'Mask Type','Real/Imag to Complex')
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/RI2C']],...
		'Mask Dialogue','Construct complex vector from real and imaginary vectors.')
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/RI2C']],...
		'Mask Help','The Real/Imag to Complex block creates a complex output from the two inputs. It uses a Mux block to append the complex part (input 2) to the real part (input 1).')
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/RI2C']],...
		'position',[470,119,545,161])

add_block('built-in/Note',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/R_out']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/R_out']],...
		'position',[445,45,450,50])

add_block('built-in/Sum',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Sum']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Sum']],...
		'inputs','+-',...
		'position',[375,60,395,80])

add_block('built-in/Product',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Product1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Product1']],...
		'position',[300,93,330,117])

add_block('built-in/Product',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Product']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/Product']],...
		'position',[300,33,330,57])

add_block('built-in/Note',[sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/R1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1/R1']],...
		'position',[190,15,195,20])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[410,220;425,220;425,150;465,150])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[400,70;425,70;425,130;465,130])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[335,45;345,45;345,65;370,65])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[335,105;345,105;345,75;370,75])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[120,40;295,40])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[238,40;238,190;305,190])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[105,155;270,155;270,50;295,50])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[270,155;270,235;305,235])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[155,175;280,175;280,110;295,110])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[280,175;280,200;305,200])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[160,65;245,65;245,100;295,100])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[250,100;250,245;305,245])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[345,195;355,195;355,215;380,215])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[345,240;355,240;355,225;380,225])
add_line([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],[550,140;580,140])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],...
		'Mask Display','plot(0,0,100,100,x,y,u,v);QAM',...
		'Mask Type','QM DSB-SC AM CE')
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],...
		'Mask Dialogue','Modulate the in-phase and quadrature\ncomponent signal from the 1st and 2nd\ninput ports, baseband simulation.|Initial phase (rad):')
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],...
		'Mask Translate','Ph=@1;x1=cos(Ph);x2=sin(Ph);[x,y]=moduicon(1);[u,v]=cmplxicn(1,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],...
		'Mask Help','This block outputs the complex envelope of the quadratic multiplexed double-sideband suppressed-carrier amplitude modulated signal. The 1st and 2nd input ports input the in-phase and quadrature components. The output is a complex signal.')
set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],...
		'Mask Entries','Ph\/')


%     Finished composite block ['C-map QASK',13,'mod baseband/QAM',13,'baseband1'].

set_param([sys,'/',['C-map QASK',13,'mod baseband/QAM',13,'baseband1']],...
		'ForeGround',4,...
		'hide name',0,...
		'position',[180,23,260,67])


%     Subsystem  ['C-map QASK',13,'mod baseband/QASK',13,'circle-map'].

new_system([sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map']],'Location',[58,103,403,268])

add_block('built-in/Zero-Order Hold',[sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/Zero-Order',13,'Hold1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/Zero-Order',13,'Hold1']],...
		'Sample time','td',...
		'position',[80,14,115,46])

add_block('built-in/Inport',[sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/in_1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/in_1']],...
		'position',[25,20,45,40])

add_block('built-in/Look Up Table',[sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/real part']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/real part']],...
		'Input_Values','x',...
		'Output_Values','y1',...
		'position',[180,17,215,43])

add_block('built-in/Look Up Table',[sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/imag part1']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/imag part1']],...
		'Input_Values','x',...
		'Output_Values','y2',...
		'position',[175,97,210,123])

add_block('built-in/Outport',[sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/Real']])
set_param([sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/Real']],...
		'position',[275,20,295,40])

add_block('built-in/Outport',[sys,'/',['C-map QASK',13,'mod baseband/QASK',13,'circle-map/Imag']])

⌨️ 快捷键说明

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