Вы находитесь на странице: 1из 4

第三次作业

名字: ENRIQUE OSCAR LARUTA MAMANI (马尼)

学号:2017290005

仿真正交相移键控调制(QPSK)的基带数字通信系统通过 AWGN 信道的误符号率和误比特率,


假设发射端信息比特采用 Gray 编码映射, 基带脉冲采用矩形脉冲, 仿真时每个脉冲的抽样点
数为 8,最大多普勒频移是 10。对 AWGN 信道和瑞丽衰落信道进行对比. 画出星座图、误比特率、
误符号率;并作说明

代码:

clear all
nSamp = 8; %Sampling points of rectangular pulse
numSymb = 10000; %Number of symbols transmitted under each SNR
fs = numSymb*nSamp;
fd = 10; % dopler
t = 0:1/fs:1-1/fs;

M=4; %QPSK number of symbol types; every two bits map a


symbol
SNR=-3:3; %SNR range
grayencod=[0 1 3 2]; %Gray encoding format
[dummy, graydecod] = sort(grayencod);
graydecod = graydecod - 1;

for ii=1:length(SNR)
msg=randsrc(1,numSymb,[0:3]); % generate send symbol
msg_gr=grayencod(msg+1); %Gray coded mapping
msg_tx=pskmod(msg_gr,M); %QPSK modulation
msg_tx=rectpulse(msg_tx,nSamp); %rectangular pulse shaping
h=rayleighchan(1/fs,fd);
msg_tx1=filter(h,msg_tx);

msg_rx = awgn(msg_tx,SNR(ii),'measured'); % through AWGN channel


msg_rx_down = intdump(msg_rx,nSamp); % matched filter coherent
demodulation
msg_gr_demod = pskdemod(msg_rx_down,M); % QPSK demodulation
msg_demod = graydecod(msg_gr_demod+1); % Gray code inverse mapping
[errorBit BER(ii)] = biterr(msg, msg_demod,log2(M)); % calculate
BER
[errorSym SER(ii)] = symerr(msg, msg_demod); % calculate SER

msg_rx1 = awgn(msg_tx1,SNR(ii),'measured') % through AWGN channel


msg_rx_down1 = intdump(msg_rx1,nSamp); % Matched filter
coherent demodulation
msg_gr_demod1 = pskdemod(msg_rx_down1,M); % QPSK demodulation
msg_demod1 = graydecod(msg_gr_demod1+1); % Gray encoding inverse
mapping
[errorBit BER1(ii)] = biterr(msg, msg_demod1,log2(M)); % calculate
BER
[errorSym SER1(ii)] = symerr(msg, msg_demod1); % calculate SER
end

scatterplot(msg_tx(1:100));
% Generate constellation
% Draw the constellation of the transmitted signal
title('Transmitted Signal Constellation')
xlabel('In-phase component')
ylabel('Orthogonal component')

scatterplot(msg_rx(1:100));
%Draw the constellation of the received signal
title('Received signal constellation')
xlabel('In-phase component')
ylabel('Orthogonal component')

scatterplot(msg_rx1(1:100));
% Draw the constellation of the received signal
title('Received signal constellation')
xlabel('In-phase component')
ylabel('Orthogonal component')

figure
semilogy(SNR,BER,'-ro',SNR,SER,'-r*',SNR,BER1,'-r+',SNR,SER1,'-r^');
% Draw BER and SNR changes with SNR Of the curve
legend('AWGN BER','AWGN SER','AWGN+Rayleigh BER','AWGN+Rayleigh SER')
% creates a legend with descriptive labels for each plotter data
series
title('QPSK performance under AWGN channel')
%performance of QPSK in AWGN channel & AWGN+Rayleigh channel
xlabel('Signal to Noise Ratio?dB?') % SNR(dB)
ylabel('Symbol error rate and bit error rate')
% Bit error ratio & Symbol error ratio
As can be seen from the above figure, as the SNR increases,
the BER and SER of QPSK both decrease, and the BER is less
than the corresponding SER, which is consistent with the actual
situation It shows that the simulation results are correct

Вам также может понравиться