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

📄 tutcdwmo.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 5 页
字号:
add_line([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],[305,190;325,190])
add_line([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],[360,80;385,80])
add_line([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],[450,80;475,80])
add_line([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],[360,185;385,185])
add_line([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],[450,185;475,185])
add_line([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],[85,120;105,120])
set_param([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],...
		'Mask Display','plot(0,0,100,100,x,y);QADM',...
		'Mask Type','Passband DSB-SC QADM')
set_param([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],...
		'Mask Dialogue','Demodulate a DSB-SC QAM modulated\nsignal into in-phase and quadrature\ncomponents.|Carrier frequency (Hz):|Lowpass filter numerator:|Lowpass filter denominator:|Initial phase (rad):|Sample time (sec):')
set_param([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],...
		'Mask Translate','Fc=@1*2*pi;num=@2;den=@3;Ph=@4;ts=@5;[x,y]=moduicon(2);')
set_param([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],...
		'Mask Help','This block demodulates the QM-DSB-SC-AM modulated signal. The first output port outputs the in-phase component and the second port outputs the quadrature component. The demodulation uses a discrete-time lowpass filter that passes the signal message and eliminates the carrier signal. ')
set_param([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],...
		'Mask Entries','Fc\/num\/den\/Ph\/ts\/')


%     Finished composite block ['Square-map',13,'QASK demod1/QADM',13,'passband'].

set_param([sys,'/',['Square-map',13,'QASK demod1/QADM',13,'passband']],...
		'ForeGround',4,...
		'hide name',0,...
		'position',[90,28,170,72])

add_block('built-in/Inport',[sys,'/',['Square-map',13,'QASK demod1/in_1']])
set_param([sys,'/',['Square-map',13,'QASK demod1/in_1']],...
		'position',[40,40,60,60])

add_block('built-in/Outport',[sys,'/',['Square-map',13,'QASK demod1/out_1']])
set_param([sys,'/',['Square-map',13,'QASK demod1/out_1']],...
		'position',[320,40,340,60])
add_line([sys,'/',['Square-map',13,'QASK demod1']],[175,40;200,40])
add_line([sys,'/',['Square-map',13,'QASK demod1']],[175,60;200,60])
add_line([sys,'/',['Square-map',13,'QASK demod1']],[290,50;315,50])
add_line([sys,'/',['Square-map',13,'QASK demod1']],[65,50;85,50])
set_param([sys,'/',['Square-map',13,'QASK demod1']],...
		'Mask Display','plot(0,0,100,100,x,y);S-QASK',...
		'Mask Type','Passband S-QASK demodulation')
set_param([sys,'/',['Square-map',13,'QASK demod1']],...
		'Mask Dialogue','Demodulate a QASK modulated signal\nusing square constellation.|M-ary number (output integer in range [0 M-1]):|Symbol interval (sec):|Carrier Frequency (Hz):|Initial phase (rad):|Sample time (sec):')
set_param([sys,'/',['Square-map',13,'QASK demod1']],...
		'Mask Translate','M=@1;td=@2;Fc=@3;Ph=@4;ts=@5;[num,den]=butter(5,Fc*2*ts);[x,y]=moduicon(6);')
set_param([sys,'/',['Square-map',13,'QASK demod1']],...
		'Mask Help','This block demodulates a MQASK modulated signal. The output signals are digits in the range [0, M-1]. When the symbol interval is a two-element vector, the second element is the offset (default 0). A default lowpass filter is used in the demodulation, which is [num, den]=butter(5, Fc*2*ts). Ungroup this block to specify the numerator and denominator of the lowpass filter.')
set_param([sys,'/',['Square-map',13,'QASK demod1']],...
		'Mask Entries','128\/.01\/1000\/0\/.0002\/')


%     Finished composite block ['Square-map',13,'QASK demod1'].

set_param([sys,'/',['Square-map',13,'QASK demod1']],...
		'hide name',0,...
		'position',[485,63,565,107])

add_block('built-in/S-Function',[sys,'/',['Integer scalar',13,'to vector']])
set_param([sys,'/',['Integer scalar',13,'to vector']],...
		'hide name',0,...
		'function name','simde2bi',...
		'parameters','len, p',...
		'Mask Display','Sca to vec\nconverter',...
		'Mask Type','Decimal to base M vector')
set_param([sys,'/',['Integer scalar',13,'to vector']],...
		'Mask Dialogue','Convert decimal integer input to base M\ninteger and output each position of the\nconverted integer using output vector.|Output vector length:|Conversion base M:')
set_param([sys,'/',['Integer scalar',13,'to vector']],...
		'Mask Translate','len=@1;p=@2;')
set_param([sys,'/',['Integer scalar',13,'to vector']],...
		'Mask Help','This block converts decimal integer scalar input to a base M integer. M must be a\npositive integer. The block outputs the base M integer using a vector. The 1st element in the output vector contains the 1''s position. The 2nd element in the output vector contains the M''s position, and so on. The output vector length is given by setting the parameter entry.')
set_param([sys,'/',['Integer scalar',13,'to vector']],...
		'Mask Entries','7\/2\/',...
		'position',[580,63,660,107])


%     Subsystem  ['Binary vector',13,'BCH decode'].

new_system([sys,'/',['Binary vector',13,'BCH decode']])
set_param([sys,'/',['Binary vector',13,'BCH decode']],'Location',[157,499,740,659])

add_block('built-in/Memory',[sys,'/',['Binary vector',13,'BCH decode/Memory']])
set_param([sys,'/',['Binary vector',13,'BCH decode/Memory']],...
		'orientation',2,...
		'x0','zeros(1,k+1)',...
		'position',[295,95,335,125])

add_block('built-in/Switch',[sys,'/',['Binary vector',13,'BCH decode/Switch']])
set_param([sys,'/',['Binary vector',13,'BCH decode/Switch']],...
		'Threshold','0.5',...
		'position',[295,44,325,76])

add_block('built-in/S-Function',[sys,'/',['Binary vector',13,'BCH decode/S-function']])
set_param([sys,'/',['Binary vector',13,'BCH decode/S-function']],...
		'function name','simbchdc',...
		'parameters','n, k, t,tp,dim',...
		'position',[170,20,235,40])

add_block('built-in/Mux',[sys,'/',['Binary vector',13,'BCH decode/Mux']])
set_param([sys,'/',['Binary vector',13,'BCH decode/Mux']],...
		'inputs','[n, 1]',...
		'position',[80,41,115,74])

add_block('built-in/Inport',[sys,'/',['Binary vector',13,'BCH decode/in_1']])
set_param([sys,'/',['Binary vector',13,'BCH decode/in_1']],...
		'position',[20,15,40,35])

add_block('built-in/Inport',[sys,'/',['Binary vector',13,'BCH decode/in_2']])
set_param([sys,'/',['Binary vector',13,'BCH decode/in_2']],...
		'Port','2',...
		'position',[10,100,30,120])

add_block('built-in/Demux',[sys,'/',['Binary vector',13,'BCH decode/Demux']])
set_param([sys,'/',['Binary vector',13,'BCH decode/Demux']],...
		'outputs','[k, 1]',...
		'position',[395,40,435,75])

add_block('built-in/Outport',[sys,'/',['Binary vector',13,'BCH decode/out_1']])
set_param([sys,'/',['Binary vector',13,'BCH decode/out_1']],...
		'position',[495,30,515,50])

add_block('built-in/Outport',[sys,'/',['Binary vector',13,'BCH decode/out_2']])
set_param([sys,'/',['Binary vector',13,'BCH decode/out_2']],...
		'Port','2',...
		'position',[495,95,515,115])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[330,60;390,60])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[360,60;360,110;340,110])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[290,110;255,110;255,70;290,70])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[240,30;255,30;255,50;290,50])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[45,25;60,25;60,50;75,50])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[120,60;150,60;150,30;165,30])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[35,110;200,110;200,60;290,60])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[60,110;60,65;75,65])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[440,50;455,50;455,40;490,40])
add_line([sys,'/',['Binary vector',13,'BCH decode']],[440,65;455,65;455,105;490,105])
set_param([sys,'/',['Binary vector',13,'BCH decode']],...
		'Mask Display','plot(0,0,100,100,x,y,v,w);BCH de',...
		'Mask Type','Vector I/O BCH decode')
set_param([sys,'/',['Binary vector',13,'BCH decode']],...
		'Mask Dialogue','BCH decode with input codeword vector\nlength N, output message vector length K, and error-correction capability T. (N,K,T) must be a valid BCH code combination.|Codeword length N (N=2^M-1. M is a >2 integer):|Message length K (check BCHPOLY for valid K):|Error-correction capability T (0 for unknown):')
set_param([sys,'/',['Binary vector',13,'BCH decode']],...
		'Mask Translate','n=@1;k=@2;t=@3;if t<=0, [x1,x2,x3,x4,t]=bchpoly(n,k);end;dim=3;pow_dim=7;while pow_dim<n,dim=dim+1;pow_dim=2^dim-1;end;tp=gftuple([-1:n-1]'',dim);[x,y]=codeicon(2);[v,w]=trigicon(0,25,get_param(gcb,''orientation''));')
set_param([sys,'/',['Binary vector',13,'BCH decode']],...
		'Mask Help','This block decodes length N binary vector codeword input into length K binary vector message output using BCH code. The block refreshes its decoding output when the enable signal at the second inport has positive value. The second outport outputs the number of errors detected in the process. A negative value indicates the block found more error in the codeword than T.')
set_param([sys,'/',['Binary vector',13,'BCH decode']],...
		'Mask Entries','7\/4\/1\/')


%     Finished composite block ['Binary vector',13,'BCH decode'].

set_param([sys,'/',['Binary vector',13,'BCH decode']],...
		'hide name',0,...
		'position',[685,73,765,117])

add_block('built-in/S-Function',[sys,'/',['Integer vector',13,'to scalar2']])
set_param([sys,'/',['Integer vector',13,'to scalar2']],...
		'hide name',0,...
		'function name','simbi2de',...
		'parameters','p',...
		'Mask Display','Vec to sca\nconverter',...
		'Mask Type','Base M vector to decimal integer')
set_param([sys,'/',['Integer vector',13,'to scalar2']],...
		'Mask Dialogue','Convert base M integer with each\nposition in the input vector into scalar decimal output.|Input integer base M:',...
		'Mask Translate','p=@1;')
set_param([sys,'/',['Integer vector',13,'to scalar2']],...
		'Mask Help','This block convert the base M vector into scalar decimal integer output. Each element of the input vector is one position of the digit of the base M integer. The 1st element in the input vector contains the 1''s position. The 2nd element in the input vector contains the M''s position.')
set_param([sys,'/',['Integer vector',13,'to scalar2']],...
		'Mask Entries','2\/',...
		'position',[785,63,865,107])


%     Subsystem  'Error rate'.

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

add_block('built-in/S-Function',[sys,'/','Error rate/S-function'])
set_param([sys,'/','Error rate/S-function'],...
		'function name','sbiterr',...
		'parameters','num_lin, K, TDelay, Sample',...
		'position',[130,52,195,78])

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

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

add_block('built-in/Inport',[sys,'/','Error rate/in_2'])
set_param([sys,'/','Error rate/in_2'],...
		'Port','2',...
		'position',[15,60,35,80])
add_line([sys,'/','Error rate'],[105,65;125,65])
add_line([sys,'/','Error rate'],[40,55;60,55])
add_line([sys,'/','Error rate'],[40,70;60,70])
set_param([sys,'/','Error rate'],...
		'Mask Display','Error Rate\nMeter',...
		'Mask Type','Symbol/Bit Error Counter.')
set_param([sys,'/','Error rate'],...
		'Mask Dialogue','Compare 2nd port input to scalar 1st port input. Compute the error rate.|Bit per symbol:|Number of digit on display:|Delay between input (1st port) and output (2nd port):|Sampling time (second):')
set_param([sys,'/','Error rate'],...
		'Mask Translate','K=@1;num_lin=@2;TDelay=@3;Sample=@4;')
set_param([sys,'/','Error rate'],...
		'Mask Help','The signal from the first port should be always be a scalar. The 2nd port input signal can be a vector with a same time delay to the input signal.',...
		'Mask Entries','4\/20\/0.008\/0.01\/')


%     Finished composite block 'Error rate'.

set_param([sys,'/','Error rate'],...
		'hide name',0,...
		'position',[885,23,960,67])


%     Subsystem  ['Rising edge',13,'detector'].

new_system([sys,'/',['Rising edge',13,'detector']])
set_param([sys,'/',['Rising edge',13,'detector']],'Location',[282,116,671,290])

add_block('built-in/Outport',[sys,'/',['Rising edge',13,'detector/out_1']])
set_param([sys,'/',['Rising edge',13,'detector/out_1']],...
		'position',[340,25,360,45])

⌨️ 快捷键说明

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