📄 tddmmpsk.m
字号:
set_param([sys,'/','MPSK demod/Min//max index2'],...
'Mask Dialogue','Choose the index of the input vector with\nmax/min value at sampling point. Hold the\nvalue for the rest of the period.|Symbol interval (sec):|''max'' or ''min'':')
set_param([sys,'/','MPSK demod/Min//max index2'],...
'Mask Translate','td=@1;mima=@2;')
set_param([sys,'/','MPSK demod/Min//max index2'],...
'Mask Help','This block outputs the index of the vector element that has the maximum or minimum value in the input vector. The computation starts at the sampling time point. The block holds the value for the rest of the interval.')
set_param([sys,'/','MPSK demod/Min//max index2'],...
'Mask Entries','td\/''max''\/')
% Finished composite block 'MPSK demod/Min//max index2'.
set_param([sys,'/','MPSK demod/Min//max index2'],...
'position',[185,53,265,97])
add_block('built-in/Inport',[sys,'/','MPSK demod/in_1'])
set_param([sys,'/','MPSK demod/in_1'],...
'position',[10,65,30,85])
add_block('built-in/Outport',[sys,'/','MPSK demod/out_1'])
set_param([sys,'/','MPSK demod/out_1'],...
'position',[295,65,315,85])
add_line([sys,'/','MPSK demod'],[145,75;180,75])
add_line([sys,'/','MPSK demod'],[35,75;55,75])
add_line([sys,'/','MPSK demod'],[270,75;290,75])
set_param([sys,'/','MPSK demod'],...
'Mask Display','plot(0,0,100,100,x,y);MPSK',...
'Mask Type','Passband MPSK demodulation')
set_param([sys,'/','MPSK demod'],...
'Mask Dialogue','Demodulate a MPSK modulated signal using correlation method.|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,'/','MPSK demod'],...
'Mask Translate','M=@1;Fc=@3;Ph=@4;td=@2;ts=@5;[x,y]=moduicon(8);')
set_param([sys,'/','MPSK demod'],...
'Mask Help','This block demodulates a MPSK modulated signal using correlation method. The output signals are digits in range [0, M-1], where M is the M-ary number. When the symbol interval is a two-element vector, the second element is the offset (default 0).')
set_param([sys,'/','MPSK demod'],...
'Mask Entries','M\/td\/Fc\/0\/ts\/')
% Finished composite block 'MPSK demod'.
set_param([sys,'/','MPSK demod'],...
'hide name',0,...
'position',[365,63,445,107])
% Subsystem 'Error rate1'.
new_system([sys,'/','Error rate1'])
set_param([sys,'/','Error rate1'],'Location',[255,368,509,510])
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_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/Inport',[sys,'/','Error rate1/in_1'])
set_param([sys,'/','Error rate1/in_1'],...
'position',[15,45,35,65])
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_line([sys,'/','Error rate1'],[105,65;125,65])
add_line([sys,'/','Error rate1'],[40,55;60,55])
add_line([sys,'/','Error rate1'],[40,70;60,70])
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,53,565,97])
% Subsystem ['AWGN',13,'channel'].
new_system([sys,'/',['AWGN',13,'channel']])
set_param([sys,'/',['AWGN',13,'channel']],'Location',[11,262,273,408])
add_block('built-in/Inport',[sys,'/',['AWGN',13,'channel/in_1']])
set_param([sys,'/',['AWGN',13,'channel/in_1']],...
'position',[45,10,65,30])
add_block('built-in/Outport',[sys,'/',['AWGN',13,'channel/out_1']])
set_param([sys,'/',['AWGN',13,'channel/out_1']],...
'position',[200,55,220,75])
add_block('built-in/Sum',[sys,'/',['AWGN',13,'channel/Sum']])
set_param([sys,'/',['AWGN',13,'channel/Sum']],...
'position',[150,55,170,75])
% Subsystem ['AWGN',13,'channel/Gaussian noise',13,'generator'].
new_system([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],'Location',[22,119,370,243])
add_block('built-in/State-Space',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Matrix',13,'Gain']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'A','[]',...
'B','[]',...
'C','[]',...
'D','K',...
'Mask Display','K',...
'Mask Type','Matrix Gain')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'Mask Dialogue','Matrix Gain.|Gain matrix:',...
'Mask Translate','K = @1;')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
'Mask Entries','d\/',...
'position',[140,61,165,89])
add_block('built-in/White Noise',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Random',13,'Number']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Random',13,'Number']],...
'Seed','s',...
'position',[35,57,80,93])
add_block('built-in/Constant',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Constant']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Constant']],...
'Value','m',...
'position',[140,20,160,40])
add_block('built-in/Sum',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Sum']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/Sum']],...
'position',[220,60,240,80])
add_block('built-in/Outport',[sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/out_1']])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator/out_1']],...
'position',[285,60,305,80])
add_line([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],[165,30;190,30;190,65;215,65])
add_line([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],[245,70;280,70])
add_line([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],[170,75;215,75])
add_line([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],[85,75;135,75])
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
'Mask Display','plot(0,0,100,100,x,y);Gaussian',...
'Mask Type','Gaussian noise generator')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
'Mask Dialogue','Generate Gaussian distributed noise with\ngiven mean and variance value.|Mean value:|Variance (vector or matrix):|Initial seed:')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);[x,y]=srcsicon(3);')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
'Mask Help','When the mean value and seed are vectors, the output of this block is a vector. The length of the vector is the same as the length of the mean value vector or the length of the seed. When the variance entry is a vector, the variance is a diagonal matrix.')
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
'Mask Entries','m\/d\/s\/')
% Finished composite block ['AWGN',13,'channel/Gaussian noise',13,'generator'].
set_param([sys,'/',['AWGN',13,'channel/Gaussian noise',13,'generator']],...
'position',[25,48,105,92])
add_line([sys,'/',['AWGN',13,'channel']],[175,65;195,65])
add_line([sys,'/',['AWGN',13,'channel']],[70,20;115,20;115,60;145,60])
add_line([sys,'/',['AWGN',13,'channel']],[110,70;145,70])
set_param([sys,'/',['AWGN',13,'channel']],...
'Mask Display','plot(0,0,100,100,x,y);AWGN',...
'Mask Type','AWGN channel, fixed parameter')
set_param([sys,'/',['AWGN',13,'channel']],...
'Mask Dialogue','Additive white Gaussian noise channel\nwith fixed mean and variance.|Mean value:|Variance (std^2):|Initial Seed:')
set_param([sys,'/',['AWGN',13,'channel']],...
'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);[x,y]=chanicon;')
set_param([sys,'/',['AWGN',13,'channel']],...
'Mask Help','This block adds white Gaussian noise to the input signal. The mean and the variance can be a scalar or vector with the same length as the input signal.')
set_param([sys,'/',['AWGN',13,'channel']],...
'Mask Entries','0\/.01\/12345\/')
% Finished composite block ['AWGN',13,'channel'].
set_param([sys,'/',['AWGN',13,'channel']],...
'position',[265,63,345,107])
add_line(sys,[120,85;155,85])
add_line(sys,[450,85;480,85])
add_line(sys,[130,85;130,30;465,30;465,65;480,65])
add_line(sys,[245,85;260,85])
add_line(sys,[350,85;360,85])
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 + -