L_frame=130; N_packet=4000; % 130 encoded symbols, the simulation of 4000
B=2; 1/2/3 %/4 for BPSK/QPSK/16 qam, 64 qam
SNRdBs=[0:2:20]; For sq2=SQRT (2);
For iter=1:3
If iter==1, NT=1; NR=1; Gs='- kx'; Black x % SISO,
Elseif iter==2, NT=1; NR=2; Gs='- ^; % 1 send 2, nabla
The else NT=1; NR=4; Gs='- ro; The % 1/4, red circle
End
Sq_NT=SQRT (NT);
For i_SNR=1: length (SNRdBs)
SNRdB=SNRdBs (i_SNR); Sigma=SQRT (0.5/(10 ^ (SNRdB/10))); % Rayleigh distribution parameter
% number, noise standard deviation
For i_packet=1: N_packet
symbol_data=https://bbs.csdn.net/topics/randint (L_frame * b, NT); Produce L_frame * % b row NT column binary information
[temp, sym_tab, P]=modulator (symbol_data. ', b); The function called % modulation, work
% can see the second page
this documentX=temp. '; X % of modulated sequences (L_frame line 1 column)
Hr=(randn (L_frame, NR) + j * randn (L_frame, NR))/for sq2; Rayleigh fading channel %
% coefficientH=reshape (Hr, L_frame, NR); % to reset the Hr club (L_frame NR)
Habs=sum (abs (H). ^ 2, 2);
Z=0;
For I=1: NR
R (:, I)=sum (H (: I). * X, 2)/sq_NT + sigma * (randn (L_frame, 1) + j * randn (L_frame, 1)); % after channel and the complex gaussian white noise
Z=Z + R (:, I). * conj (H (: I)); % MRC merger, consolidation coefficient for the conj (H (: I))
End
For m=1: P % maximum likelihood decoding
D1 (:, m)=abs (sum (Z, 2) - sym_tab (m))) ^ 2 + (1 + sum (Habs, 2)) * abs (sym_tab (m)) ^ 2;
End
[y1, i1]=min (d1, [], 2); Xd=sym_tab (i1). ';
Temp1=X> 0; Temp2=Xd> 0;
Noeb_p (i_packet)=sum (the sum (temp1 ~=temp2));
% accumulative error bitsEnd
BER (iter, i_SNR)=sum (noeb_p)/(L_frame N_packet * * b);
% calculate the bit error rateEnd % cycle end
Semilogy (SNRdBs, BER (iter), gs), hold on, the axis ([SNRdBs (end [1]), 1 e - 6 1 e0]) % drawing
End
The title (' BER perfoemancde of MRC Scheme '), xlabel (' SNR (dB)), ylabel (' BER)
The grid on the set (gca, 'fontsize, 9)
Legend (' SISO ', 'MRC (Tx: 1, the Rx: 2)', 'the MRC (Tx: 1, Rx: 4)')
The function [mod_symbols sym_table, M]=modulator (bitseq, b)
% MIMO - OFDM Wireless Communications with MATLAB to Yong Soo Cho, Jaekwon Kim, Won Young Yang and Chung g. Kang
%? 2010 John Wiley & amp; Sons (Asia) Pte Ltd
N_bits=length (bitseq);
If b==1% BPSK modulation
Sym_table=exp (j * [0] PI); Sym_table=sym_table ([0] 1 + 1);
Inp=bitseq; Mod_symbols=sym_table (inp + 1); M=2;
QPSK modulation elseif b==2%
Sym_table=exp (PI/4 j * * (1-1-3 of 3)); Sym_table=sym_table ([0, 1 2 3] + 1);
Inp=reshape (bitseq, b, N_bits/b);
Mod_symbols=sym_table ([1] 2 * inp + 1); M=4.
Elseif b==3% generates 8 PSK symbols
Sym_table=exp (PI/4 j * * [0:7]); Sym_table=sym_table ([0, 1 3 6 7 5 4] 2 + 1);
Inp=reshape (bitseq, b, N_bits/b); Mod_symbols=sym_table (* inp [4 2 1] + 1);
M=8;
Elseif b==16-4% QAM modulation
M=0; Sq10=SQRT (10);
For k=3:2:3 -
For l=3:2:3 -
M=m + 1; Sym_table (m)=(k + j * l)/sq10; % power normalization
End
End
Sym_table=sym_table ([0, 1 2 3 4 5 6 7 11 12 13 14 15 8 9 10] + 1); % Gray code mapping the pattern for 8 wpa2-psk symbols
Inp=reshape (bitseq, b, N_bits/b);
Mod_symbols=sym_table ([8 4 2 1] * inp + 1); % maps transmitted bits into 16 qam symbols
M=16; % 16 constellation points
The else
Error (' Unimplemented modulation ');
End
What is maximum likelihood decoding this principle? Please explain
For m=1: P % maximum likelihood decoding
D1 (:, m)=abs (sum (Z, 2) - sym_tab (m))) ^ 2 + (1 + sum (Habs, 2)) * abs (sym_tab (m)) ^ 2;
end
CodePudding user response:
Here, in fact, using ZF receiver to achieve maximum likelihood decoding