0% found this document useful (0 votes)
45 views

ADC Assignment 3

This document describes a simulation of transmitting bits over a channel with noise. The received bits are estimated using matched filtering (MF), zero forcing with decorrelator (DC), and minimum mean square error (MMSE) estimation. 10 copies of 500 transmitted bits are generated and transmitted over a channel with varying signal-to-noise ratios (SNRs) from 1-30 dB. The bit error rate is calculated for each estimation method and plotted versus SNR to compare their performance.

Uploaded by

luckyquaid
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

ADC Assignment 3

This document describes a simulation of transmitting bits over a channel with noise. The received bits are estimated using matched filtering (MF), zero forcing with decorrelator (DC), and minimum mean square error (MMSE) estimation. 10 copies of 500 transmitted bits are generated and transmitted over a channel with varying signal-to-noise ratios (SNRs) from 1-30 dB. The bit error rate is calculated for each estimation method and plotted versus SNR to compare their performance.

Uploaded by

luckyquaid
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

% In this assignment, the bits 'b' are transmitted and the the reciever

% recieve them as r=s*b+(sigma_n)*rand(), where sigma_n*rand() is the


noise.
% The effect of channel s is already known to the reciever, although
% equilization is not going to be done in this assignment. The
transmitted
% bits are estimated with the help of s and r using MF (matched
filter),
% DC(zero forcing using De correlator) and mse (mean square error).

clear all
clc;
H=hadamard(16);
S=H(:,1:10); % S is the channel of length 16*10
s=(1/sqrt(16))*S;
k=10; % k is the number of iterations over which the avverage is taken.

bits=500 % Total number of transmitted bits (information bits).


There is no concept of transmitted pilot bits in this code
for j=1:k
for i=1:bits
if randn()<.5 % randn() i.e the empty bracket means
the single value.
m(j,i)=-1;
else
m(j,i)=1; % m (10*500) are the transmitted bits (+1
or -1). 10 possible copies of transmitted bits are taken
end
end
end
for snr=1:30
snr_linear=(10)^(snr/10); % Absolute or linear or anti-log
value of SNR (not log)
sigma_n=sqrt(1/snr_linear);
for i=1:500
b=m(:,i);
r=s*b+(sigma_n)*rand(); % r is the recieved vector (of
length 16). Where s is the channel effect.

%% Calcualations for mf (match filter)


est_mf=(s')*r; % effect of the channel s is assumed to
be known. Note that 's' is known to the receiver, although without
equilization.
% The est_mf is actually the vector of
estimated bits.
for j=1:10
if est_mf(j,1)>=0
hat_mf(j,1)=1; % Forcing is done in order to make
posive values equal to +1
else
hat_mf(j,1)=-1; % Forcing is done in order to make
negative values equal to -1
end
end
e_mf=0;
for k=1:10 % Now the average value of the 10 copies of a bit
is taken.
if hat_mf(k,1)~=b(k,1)
e_mf=e_mf+1; % count of the erroneous bits out of 10
copies. Note that this count is under the loop (for i=1:500)
end
end
pe_mf(i)=e_mf/k; % Errors for a single bit (b/w 1 and 10) is
normalized. For all 10 errors of a single bit we get max value i.e 1.

%% Calculations for dc
R_dc=s'*s; % R_dc is the de correlator
est_dc=(R_dc^-1)*est_mf; % The only way that dc is differ
from mf is: The estimated transmitted bits est_dc are obtained
differently
% Remaining procedure below is
same
% as that of mf.
for k=1:10
if est_dc(k,1)>=0
hat_dc(k,1)=1;
else
hat_dc(k,1)=-1;
end
end
e_dc=0;
for k=1:10
if hat_dc(k,1)~=b(k,1)
e_dc=e_dc+1;
else
end
end
pe_dc(i)=e_dc/k;

%% for mms
R_mms=s'*s+(sigma_n^2)*eye(10); % R_mms is the mms correlator
est_mms=(R_mms^-1)*est_mf;
hat_mms=zeros(10,1);
for j=1:10
if est_mms(j,1)>=0
hat_mms(j,1)=1;
else
hat_mms(j,1)=-1;
end
end
e_mms=0;
for k=1:10
if hat_mms(k,1)~=b(k,1)
e_mms=e_mms+1;
end
end
pe_mms(i)=e_mms/k;
%%
end % end for (for i=500)
pe_snr_dc(snr)=mean(pe_dc); % mean value of erro for 500 bits
(and not of the 10 copies(iterations) of the bits)
pe_snr_mf(snr)=mean(pe_mf);
pe_snr_mms(snr)=mean(pe_mms);

end % end for (for snr=1:30)

semilogy([1:30],[pe_snr_mf],'r')
title('error probability curve for mf')
figure
semilogy([1:30],[pe_snr_mms],'k')
title('error probability curve for mms')
figure
semilogy([1:30],[pe_snr_dc],'b')
title('error probability curve for dc')

You might also like