140 likes | 227 Views
EEE-752 Emerging Wireless Networks MIMO Simulation. Riaz Hussain FA08-PCE-003 rhussain@comsats.edu.pk Ph.D. Student Department of Electrical Engineering COMSATS Institute of Information Technology Islamabad, Pakistan. Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 1.
E N D
EEE-752Emerging Wireless NetworksMIMO Simulation Riaz Hussain FA08-PCE-003 rhussain@comsats.edu.pk Ph.D. Student Department of Electrical Engineering COMSATS Institute of Information Technology Islamabad, Pakistan Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 1
MIMO • Simulation • Matlab • Comparison with theoretical values • BER Vs SNR (dB) • 64 QAM OFDM • Simulink • Understanding Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 2
MIMO Simulation • Input Parameters • N = No of bits for simulation • M = ? In MPSK • 2, 4, 8, 16, 32, and 64 • Output • Graph • BER Vs SNR (dB) Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 3
Model • Alamouti • OSTBC • Time Slot :1 Time Slot :2 • Ant: 1 S1 -S2* • Ant: 2 S2 S1* Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 4
Model • Channel Response (h) • h = [h1 h2] for time slots • Signals(s) • |--- ---| • | s1 -s2* | • s = | | for two time slots • | s2 s1* | • |--- ---| • Noise (n) • n = [n1 n2] for two time slots Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 5
Received Signal • r = h * s + n • |--- ---| • | s1 -s2* | • r = [h1 h2] * | | + [n1 n2] • | s2 s1* | • |--- ---| • r = [h1s1+h2s2 h2S1* - h1s2*] + [n1 n2] Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 6
Decode Signal • y_hat = • |--- ---| • | h1*r1 h2*r1 | • | | • | h2r2* -h1r2* | • |--- ---| Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 7
Implementation (1) • Generating Bit Stream • Uniformly distributed random variable • ip = rand(1,N) > 0.5; • Equal probability for 0s and 1s • Map bits to symbols • BPSK • sym_map=2*ip - 1; • 0 -> -1 and 1 -> 1 Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 8
Implementation (2) • Map symbols to s matrix • Change the dimensions from 1 X N to 2 X N/2 • A = reshape(sym_map, 2, N/2); • Repeat s1 and s2 for two time slots • sym_code = kron(A,ones(1,2)); • Take conjugate, inverse-conjugate and rearrange accordingly • sym_code(1,[2:2:end]) = -conj( sym_code(2,[1:2:end]) ); • sym_code(2,[2:2:end]) = conj(sym_code(1,[1:2:end])); • Keeping signal energy unchanged • sym_code = (1/sqrt(2))*sym_code; • s1 -s2* • s2 s1* Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 9
Implementation (3) • Create Rayleigh Channel • h = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; • Normally distributed • Generate normally distributed random noise • n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; • White Gausian Noise • Repeating same channel for two symbols • A = reshape(h,2,N/2); • hMod = kron(A,ones(1,2)); • Add Channel and Noise • y = sum(hMod.*sym_code,1) + 10^(-Eb_No_dB(ii)/10)*n; • Element by element multiplication and adding each column • ii ranges from 0 to 30 Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 10
y_hat = • |--- ---| • | h1*r1 h2*r1 | • | | • | h2r2* -h1r2* | • |--- ---| Implementation (4) • Decoding the received signals • Map y, the received signal array • y_mod = kron(reshape(y,2,N/2),ones(1,2)); • y_mod(2,[1:1:end]) = conj(y_mod(2,[1:1:end])); • Modify h to map to required condition • h_mod = kron(A,ones(1,2)); • h_mod(1,[1:2:end]) = conj(h_mod(1,[1:2:end])); • h_mod(1,[2:2:end]) = conj(h_mod(2,[2:2:end])); • h_mod(2,[2:2:end]) = -conj(h_mod(1,[1:2:end])); • Obtain y_hat • y_hat = sum(h_mod.*y_mod,1); • Equalize • hEqPower = sum(h.*conj(h),1); • y_hat = y_hat./hEqPower; Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 11
Implementation (5) • Extracting the bits • Using hard decision decoding • ipHat = real(y_hat) > 0 • Counting the errors • nErr(ii) = size(find([ip - ipHat]),2); • Simulating for SNR (dB); ii ranges from 0 to 30 • Finding BER • simBer = nErr/N; • Plot the graph Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 12
Simulation • BPSK • N = 10^6 Riaz Hussain rhussain@comsats.edu.pk EEE752-EWN: MIMO-Simulation 13