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

📄 tcemqask.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 4 页
字号:
		'position',[40,40,60,60])

add_block('built-in/Outport',[sys,'/',['S-map QASK',13,'demod baseband/out_1']])
set_param([sys,'/',['S-map QASK',13,'demod baseband/out_1']],...
		'position',[320,40,340,60])

add_block('built-in/Note',[sys,'/',['S-map QASK',13,'demod baseband/tab=qaskdeco(']])
set_param([sys,'/',['S-map QASK',13,'demod baseband/tab=qaskdeco(']],...
		'position',[205,180,210,185])
add_line([sys,'/',['S-map QASK',13,'demod baseband']],[175,40;200,40])
add_line([sys,'/',['S-map QASK',13,'demod baseband']],[175,60;200,60])
add_line([sys,'/',['S-map QASK',13,'demod baseband']],[290,50;315,50])
add_line([sys,'/',['S-map QASK',13,'demod baseband']],[65,50;85,50])
set_param([sys,'/',['S-map QASK',13,'demod baseband']],...
		'Mask Display','plot(0,0,100,100,x,y,u,v);S-QASK',...
		'Mask Type','Baseband S-QASK demodulation')
set_param([sys,'/',['S-map QASK',13,'demod baseband']],...
		'Mask Dialogue','Demodulate the complex envelope of a QASK modulated signal.  This block uses a fixed square constellation with M-ary number M=2^K, where K is an integer.|M-ary number (integer in range [0 M-1]):|Symbol interval and offset (sec):|Lowpass filter numerator:|Lowpass filter denominator:|Initial phase (rad):|Sample time (sec):')
set_param([sys,'/',['S-map QASK',13,'demod baseband']],...
		'Mask Translate','M=@1;td=@2;num=@3;den=@4;Ph=@5;ts=@6;[x,y]=moduicon(6);[u,v]=cmplxicn(0,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['S-map QASK',13,'demod baseband']],...
		'Mask Help','This block demodulates a QASK modulated signal using square constellation. The output signals are digits in the range [0, M-1], where M is the M-ary number, M=2^K, K is an integer. When the symbol interval is a two-element vector, the second element is the offset (default 0). ')
set_param([sys,'/',['S-map QASK',13,'demod baseband']],...
		'Mask Entries','M\/[td, td-ts]\/num\/den\/0\/ts\/')


%     Finished composite block ['S-map QASK',13,'demod baseband'].

set_param([sys,'/',['S-map QASK',13,'demod baseband']],...
		'hide name',0,...
		'position',[365,38,445,82])


%     Subsystem  'Error rate1'.

new_system([sys,'/','Error rate1'])
set_param([sys,'/','Error rate1'],'Location',[255,368,509,510])

add_block('built-in/Inport',[sys,'/','Error rate1/in_2'])
set_param([sys,'/','Error rate1/in_2'],...
		'Port','2',...
		'position',[15,60,35,80])

add_block('built-in/Inport',[sys,'/','Error rate1/in_1'])
set_param([sys,'/','Error rate1/in_1'],...
		'position',[15,45,35,65])

add_block('built-in/Mux',[sys,'/','Error rate1/Mux'])
set_param([sys,'/','Error rate1/Mux'],...
		'inputs','2',...
		'position',[65,46,100,79])

add_block('built-in/S-Function',[sys,'/','Error rate1/S-function'])
set_param([sys,'/','Error rate1/S-function'],...
		'function name','sbiterr',...
		'parameters','num_lin, K, TDelay, Sample',...
		'position',[130,52,195,78])
add_line([sys,'/','Error rate1'],[40,70;60,70])
add_line([sys,'/','Error rate1'],[40,55;60,55])
add_line([sys,'/','Error rate1'],[105,65;125,65])
set_param([sys,'/','Error rate1'],...
		'Mask Display','Error\nmeter',...
		'Mask Type','Symbol/bit error counter')
set_param([sys,'/','Error rate1'],...
		'Mask Dialogue','Use the input data from the 1st port as the reference signal to detect the number of errors and error rate of the 2nd port inputted signal.|Bit per symbol:|Number of digits on display:|Delay between input (1st port) and output (2nd port):|Sampling time (sec):')
set_param([sys,'/','Error rate1'],...
		'Mask Translate','K=@1;num_lin=@2;TDelay=@3;Sample=@4;')
set_param([sys,'/','Error rate1'],...
		'Mask Help','The signal from the first port must be a scalar. The second input port can be a vector with a same-time delay to the input signal. The comparison happens only at the sampling point.')
set_param([sys,'/','Error rate1'],...
		'Mask Entries','ceil(log10(M)/log10(2))\/20\/td\/td\/')


%     Finished composite block 'Error rate1'.

set_param([sys,'/','Error rate1'],...
		'hide name',0,...
		'position',[485,28,565,72])


%     Subsystem  ['ASK Mo//Dem',13,'demo1'].

new_system([sys,'/',['ASK Mo//Dem',13,'demo1']])
set_param([sys,'/',['ASK Mo//Dem',13,'demo1']],'Location',[175,552,335,697])
set_param([sys,'/',['ASK Mo//Dem',13,'demo1']],...
		'Mask Display','View\nconstellation',...
		'Mask Dialogue','eval(''modmap(''''qask'''',M)'')')


%     Finished composite block ['ASK Mo//Dem',13,'demo1'].

set_param([sys,'/',['ASK Mo//Dem',13,'demo1']],...
		'BackGround',7,...
		'hide name',0,...
		'position',[590,28,670,72])


%     Subsystem  ['Rayleigh noise',13,'channel CE'].

new_system([sys,'/',['Rayleigh noise',13,'channel CE']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],'Location',[496,318,758,464])

add_block('built-in/Inport',[sys,'/',['Rayleigh noise',13,'channel CE/in_1']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/in_1']],...
		'position',[45,10,65,30])


%     Subsystem  ['Rayleigh noise',13,'channel CE/Gaussian',13,'noise'].

new_system([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],'Location',[371,386,719,539])

add_block('built-in/White Noise',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Random',13,'Number']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Random',13,'Number']],...
		'Seed','s',...
		'position',[35,72,80,108])

add_block('built-in/State-Space',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']],...
		'A','[]',...
		'B','[]',...
		'C','[]',...
		'D','K',...
		'Mask Display','K',...
		'Mask Type','Matrix Gain')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']],...
		'Mask Dialogue','Matrix Gain.|Gain matrix:',...
		'Mask Translate','K = @1;')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']],...
		'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
		'Mask Entries','d\/')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Matrix',13,'Gain']],...
		'position',[130,76,155,104])

add_block('built-in/Constant',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Constant']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Constant']],...
		'Value','m',...
		'position',[155,35,175,55])

add_block('built-in/Sum',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Sum']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/Sum']],...
		'position',[240,75,260,95])

add_block('built-in/Outport',[sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/out_1']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise/out_1']],...
		'position',[295,75,315,95])
add_line([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],[180,45;210,45;210,80;235,80])
add_line([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],[85,90;125,90])
add_line([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],[160,90;235,90])
add_line([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],[265,85;290,85])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
		'Mask Display','Gaussian\nnoise',...
		'Mask Type','Gaussian noise.')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
		'Mask Dialogue','Gaussian distribution noise.|Mean value:|Standard deviation:|Initial Seed(s):',...
		'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
		'Mask Help','When the mean value, seed are vectors, the output of this block is a vector with the length of the vector same as the length of mean value vector or that of the seed.')
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
		'Mask Entries','m\/d\/s\/')


%     Finished composite block ['Rayleigh noise',13,'channel CE/Gaussian',13,'noise'].

set_param([sys,'/',['Rayleigh noise',13,'channel CE/Gaussian',13,'noise']],...
		'position',[10,50,85,90])

add_block('built-in/Outport',[sys,'/',['Rayleigh noise',13,'channel CE/out_1']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/out_1']],...
		'position',[200,55,220,75])

add_block('built-in/Sum',[sys,'/',['Rayleigh noise',13,'channel CE/Sum']])
set_param([sys,'/',['Rayleigh noise',13,'channel CE/Sum']],...
		'position',[150,55,170,75])
add_line([sys,'/',['Rayleigh noise',13,'channel CE']],[175,65;195,65])
add_line([sys,'/',['Rayleigh noise',13,'channel CE']],[70,20;115,20;115,60;145,60])
add_line([sys,'/',['Rayleigh noise',13,'channel CE']],[90,70;145,70])
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
		'Mask Display','plot(0,0,100,100,x,y,v,w,u,z);Rayl N',...
		'Mask Type','Rayleigh noise channel, fixed parameter')
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
		'Mask Dialogue','Additive Rayleigh noise channel for\nbaseband signal simulation. Input\nand output signals are complex.|sigma:|Seeds (1x2 vector):')
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
		'Mask Translate','m=0;d=@1;d=d^2;s=@2;if length(s)<2,s=[s s+s];end;[x,y]=chanicon;[v,w]=cmplxicn(0,50,get_param(gcb,''orientation''));[u,z]=cmplxicn(1,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
		'Mask Help','This block adds Rayleigh noise to the transmitting signal. The input and output of this block are complex data. The Rayleigh noise is composed by two independant zero mean Gaussian noise. These two Gaussian components have the same standard deviation sigma.')
set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
		'Mask Entries','.5\/[12345 54321]\/')


%     Finished composite block ['Rayleigh noise',13,'channel CE'].

set_param([sys,'/',['Rayleigh noise',13,'channel CE']],...
		'hide name',0,...
		'position',[255,38,335,82])
add_line(sys,[100,60;135,60])
add_line(sys,[110,60;110,15;460,15;460,40;480,40])
add_line(sys,[450,60;480,60])
add_line(sys,[225,60;250,60])
add_line(sys,[340,60;360,60])

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