0% found this document useful (0 votes)
90 views10 pages

ECE 679 Homework #3: Marco Eppenberger

The document contains MATLAB code and simulation results for analyzing MIMO systems. It simulates ergodic MIMO capacity for 1x1, 2x2, and 4x4 antenna configurations over a range of SNR values. It also simulates bit error rate for BPSK transmission over AWGN, 2x2 MIMO with MRT/MRC diversity, and 2x2 MIMO with SDT/SDC diversity. Plots of the capacity and BER simulations are presented. The MATLAB code files that generate the simulations and plots are also included.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views10 pages

ECE 679 Homework #3: Marco Eppenberger

The document contains MATLAB code and simulation results for analyzing MIMO systems. It simulates ergodic MIMO capacity for 1x1, 2x2, and 4x4 antenna configurations over a range of SNR values. It also simulates bit error rate for BPSK transmission over AWGN, 2x2 MIMO with MRT/MRC diversity, and 2x2 MIMO with SDT/SDC diversity. Plots of the capacity and BER simulations are presented. The MATLAB code files that generate the simulations and plots are also included.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Purdue University

ECE 679  Homework #3

Marco Eppenberger

April 9, 2014

Task 1

ECE 679

Homework #3

M. Eppenberger

Ergodic MIMO Capacity, perfect CSI, averaged over 200 Rayleigh channel realisations 50 1x1 Channel 2x2 Channel 45 4x4 Channel 40 35 Capacity [Bits/s/Hz] 30 25 20 15 10 5 0 5

10

15 20 SNR = [dB]

25

30

35

40

Figure 1.1: Ergodic MIMO capacity simulation

ECE 679
1.1 MATLAB-code: ex1.m

Homework #3

M. Eppenberger

File: /home/marco/Dropbox/Purdue/Adigital Comm - ECE679/HW3/ex1.m


%% Simulate ergodic Capacity for full CSI clear all close all dims_c = [1,2,4]; SNRdBvec_c = -5:1:40; NumAvg_c = 200; Cap = zeros(length(dims_c),length(SNRdBvec_c)); for dimidx = 1:length(dims_c) dim = dims_c(dimidx); for snridx = 1:numel(SNRdBvec_c); rho = 10^(SNRdBvec_c(snridx)/10); t = 0; for repidx = 1:NumAvg_c H = 1/sqrt(2).*randn(dim,dim) + 1j/sqrt(2).*randn(dim,dim); Qwf = WaterFilling(H,rho); %trace(Qwf) t = t + log2(det(eye(dim)+rho*H*Qwf*H')); end Cap(dimidx,snridx) = abs(t/NumAvg_c); end end % plot plot(SNRdBvec_c,Cap(1,:),'s-',SNRdBvec_c,Cap(2,:),'o-',SNRdBvec_c,Cap(3,:),'x-'); legend('1x1 Channel','2x2 Channel','4x4 Channel','Location','NorthWest'); xlabel('SNR = \rho [dB]'); ylabel('Capacity [Bits/s/Hz]'); title(sprintf('Ergodic MIMO Capacity, perfect CSI, averaged over %d Rayleigh channel realisations',NumAvg_c)); grid on

Page 1 of 1

ECE 679

Homework #3

M. Eppenberger

1.2 MATLAB-code: WaterFilling.m

File: /home/marco/Dropbox/Purdue/Admm - ECE679/HW3/WaterFilling.m


function [Qwf] = WaterFilling(H,rho) %WATERFILLING calculates optimal transmit power allocation for a given % channel matrix H and a given rho. %[Mr, Mt] = size(H); [~,S,V] = svd(H); lambdasq = diag(S.^2); % waterfilling algo J = numel(lambdasq); qvec = zeros(size(lambdasq)); for q = 1:J MA = J+1-q; mu = 1/MA*(1+sum(1./(rho*lambdasq(1:MA)))); for i = 1:(MA) qvec(i) = mu-1/(rho*lambdasq(i)); end if qvec(MA) > 0 break; end qvec(MA) = 0; end Q = diag(qvec); Qwf = real(V*Q*V'); end

Page 1 of 1

ECE 679
Task 4

Homework #3

M. Eppenberger

ECE 679

Homework #3

M. Eppenberger

10

BPSK transmission over different channels and different diversity techniques 1x1 AWGN 2x2 fading, MRT/MRC 2x2 fading, SDT/SDC

10

10

BER

10

10

10

10

5 SNR [dB]

10

15

20

Figure 4.1: MIMO BPSK BER simulation

ECE 679
4.1 MATLAB-code: ex4.m

Homework #3

M. Eppenberger

File: /home/marco/Dropbox/Purdue/Adigital Comm - ECE679/HW3/ex4.m


%% ECE 679 - HW 3 - Ex 4 % M Eppenberger clear all close all SNRdB_vec = -5:1:20; BER_vec = zeros(4,length(SNRdB_vec)); % AWGN sim for i = 1:length(SNRdB_vec) SNRdB = SNRdB_vec(i); fprintf('AWGN: %d dB\n',SNRdB); BER_vec(1,i) = simBPSKAWGN(SNRdB); end % fading + MRT/MRC sim for i = 1:length(SNRdB_vec) SNRdB = SNRdB_vec(i); fprintf('MRT: %d dB\n',SNRdB); BER_vec(2,i) = simBPSKMIMO(SNRdB,'MR',100000); end % fading + SDT/SDC sim for i = 1:length(SNRdB_vec) SNRdB = SNRdB_vec(i); fprintf('SDT: %d dB\n',SNRdB); BER_vec(3,i) = simBPSKMIMO(SNRdB,'SD',100000); end % fading no MIMO % for i = 1:length(SNRdB_vec) % SNRdB = SNRdB_vec(i); % fprintf('fading only: %d dB\n',SNRdB); % BER_vec(4,i) = simBPSKMIMO(SNRdB,'none',100000); % end % save results savename = strcat('SimRes',datestr(now,'yyyymmddHHMMSS'),'.mat'); save(savename,'SNRdB_vec','BER_vec');

Page 1 of 1

% plot figure semilogy(SNRdB_vec,BER_vec(1,:),'-s',SNRdB_vec,BER_vec(2,:),'-o',SNRdB_vec,BER_vec(3,:),'-x') %,SNRdB_vec,BER_vec(4,:),'--'); xlabel('SNR [dB]'); ylabel('BER'); title('BPSK transmission over different channels and different diversity techniques'); legend('1x1 AWGN','2x2 fading, MRT/MRC','2x2 fading, SDT/SDC','1x1 fading'); grid on

ECE 679

Homework #3

M. Eppenberger

4.2 MATLAB-code: simBPSKAWGN.m

File: /home/marco/Dropbox/Purdue/Adomm - ECE679/HW3/simBPSKAWGN.m


function [BER] = simBPSKAWGN(SNRdB) %SIMBPSKAWGN Simulates BPSK with a given SNRdB and returns the resulting %BER value. % constants nBits_c = 10000000; % SNR calculation rho = 10^(SNRdB/10); % sent bits and modulation onto BPSK symbols sendbits = randi([0 1],1,nBits_c); s = sqrt(rho).*(sendbits.*2-1); % AWGN channel y = s + 1/sqrt(2).*randn(size(s)); % demodulation r = (y > 0); rcvbits = +r; % perform statistics BER = nnz(rcvbits-sendbits)/nBits_c; end

Page 1 of 1

ECE 679

Homework #3

M. Eppenberger

4.3 MATLAB-code: simBPSKMIMO.m

File: /home/marco/Dropbox/Purdue/Adomm - ECE679/HW3/simBPSKMIMO.m


function [BER] = simBPSKMIMO(SNRdB,mode,reps) %SIMBPSKAWGN Simulates BPSK with a given SNRdB and returns the resulting %BER value. % constants nBits_c = 100; % SNR calculation rho = 10^(SNRdB/10); BERtemp = 0; for repidx = 1:reps % sent bits and modulation onto BPSK symbols sendbits = randi([0 1],1,nBits_c); x = sqrt(rho).*(sendbits.*2-1); % 2x2 fading channel H = 1/sqrt(2).*randn(2,2) + 1j/sqrt(2).*randn(2,2); % calculate equivalent channel if strcmp(mode,'SD') htilda = max(max(H)); elseif strcmp(mode,'MR') htilda = max(svd(H)); elseif strcmp(mode,'none') htilda = H(1); else error('No correct mode selected; mode = {SD, MR, none}.'); end % transmit data through equivalent SISO channel y = abs(htilda)^2*x + 1/sqrt(2).*randn(size(x)); % demodulation r = (y > 0); rcvbits = +r; % perform statistics BERtemp = BERtemp + nnz(rcvbits-sendbits)/nBits_c; end BER = BERtemp/reps; end

Page 1 of 1

ECE 679

Homework #3

M. Eppenberger

10

You might also like