You are on page 1of 4

Problem 2.

Analysis: In the two simulations, channel two has better performance than channel 1. Also, the SNR
required to achieve less errors is smaller in the case of the equalizer with fewer taps. There is little
difference between MMSE and ZF equalizers but the errors seem to decrease for the MMSE.

K=1e6; %K random integers


Xint=randi(4,1,K); %Generates random integer sequence
Es=1; %Symbol energy
M=4; %Number of symbols in the constellation

Sm=[-3 -1 1 3];

%plot(Sm,0,'*'); %Points of the constellation

s=zeros(1,length(Xint));
for i=1:length(Xint)
for j=1:4;
if Xint(1,i) == j
s(:,i) = Sm(:,j);
end
end
end

Yint1=zeros(1,length(Xint));
D1=zeros(1,4);
NE1=zeros(1,13);

Yint2=zeros(1,length(Xint));
D2=zeros(1,4);
NE2=zeros(1,13);

a=1:4;

for i=0:2:24

ht1 = [0.227 0.46 0.688 0.46 0.227];


L1 = length(ht1);
chanOut1 = conv(s,ht1);
y1=awgn(chanOut1,i);

ht2 = [0.407 0.815 0.407];


L2 = length(ht2);
chanOut2 = conv(s,ht2);
y2=awgn(chanOut2,i);
for k=5:5:15

hM1=toeplitz([ht1((L1+1)/2:end) zeros(1,(2*k+1)-(L1+1)/2)], [ht1((L1+1)/2:-1:1)


zeros(1,(2*k+1)-(L1+1)/2)]);
d1=zeros(1,2*k+1);
d1(k+1)=1;
c1=((hM1)\d1')';

hM2=toeplitz([ht2((L2+1)/2:end) zeros(1,(2*k+1)-(L2+1)/2)], [ht2((L2+1)/2:-1:1)


zeros(1,(2*k+1)-(L2+1)/2)]);
d2=zeros(1,2*k+1);
d2(k+1)=1;
c2=((hM2)\d2')';

ypr01 = conv(y1,c1);
ypr1 = ypr01(k+(L1+1)/2:end);
yhat1 = ypr1(1:1:K);

ypr02 = conv(y2,c2);
ypr2 = ypr02(k+(L2+1)/2:end);
yhat2 = ypr2(1:1:K);

for j=1:length(Xint)
Y1=repmat(yhat1(:,j),1,M);
D1(1,a)=sqrt((Y1(1,:)-Sm(1,a)).^2);
[minD1,ind1]= min(D1);
Yint1(j)=ind1;

Y2=repmat(yhat2(:,j),1,M);
D2(1,a)=sqrt((Y2(1,:)-Sm(1,a)).^2);
[minD2,ind2]= min(D2);
Yint2(j)=ind2;
end

NE1(k/5,(i+2)/2)=length(find(Xint-Yint1));
NE2(k/5,(i+2)/2)=length(find(Xint-Yint2));

end
end

SER1=NE1/length(Xint);
SER2=NE2/length(Xint);

SNR=0:2:24;
semilogy(SNR,(SER1(1,:)),'*-')
title('Symbol error probability curve for ZF Equalizer');
xlabel('SNR [dB]');
ylabel('SER');
grid on;
hold on;
semilogy(SNR,(SER1(2,:)),'*-')
semilogy(SNR,(SER1(3,:)),'*-')
semilogy(SNR,(SER2(1,:)),'*-')
semilogy(SNR,(SER2(2,:)),'*-')
semilogy(SNR,(SER2(3,:)),'*-')

% upbound=zeros(1,13);
% for i=0:2:24
% upbound(1,(i+2)/2) = 2*((M-1)/M)*qfunc(sqrt(2*10^(i/10)*log2(M)*(sin(pi/M)^2)));%%%is the value
of i (SNR) correct???
% end
% semilogy(SNR,upbound,'*-')
%
% Nmin=2;
% lowbound=zeros(1,21);
% for i=0:20
% lowbound(1,i+1) = (Nmin/M)*qfunc(sqrt(2*10^(i/10)*log2(M)*(sin(pi/M)^2)));%%%is the value of i
(SNR) correct???
% end
% semilogy(SNR,lowbound,'*-')
%
legend('11-taps - Channel 1','21-taps - Channel 1','31-taps - Channel 1','11-taps - Channel
2','21-taps - Channel 2','31-taps - Channel 2');

Published with MATLAB R2015b

You might also like