%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Authored by Samir Kumar Mishra, University College of Engg.
%Normalised Least Mean Squares Based Equalizer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo on
N=500;
K=5;
actual_isi=[0.05 -0.063 0.088 -0.126 -0.25 0.9047 0.25 0.126 0.038 0.088];
sigma=0.01;
delta=0.09;
Num_of_Realizations = 1000;
mse_av=zeros(1,N-2*K);
for j=1:Num_of_Realizations,
%information sequence
for i=1:N,
if (rand<0.5),
info(i)=-1;
else
info(i)=1;
end;
echo off;
end;
if (j==1);echo on ; end
%The Channel Output
y=filter(actual_isi,1,info);
for i=1:2:N, [noise(i) noise(i+1)]=gngauss(sigma); end;
y=y+noise;
%Now the Equalization part follows
estimated_c=[0 0 0 0 0 1 0 0 0 0 0]; %Initial Estimate of ISI
for k=1:N-2*K,
y_k=y(k:k+2*K);
z_k=estimated_c*y_k.';
e_k=info(k)-z_k;
estimated_c=estimated_c+delta*e_k*y_k/(norm(y_k)+0.001);
mse(k)=e_k^2;
echo off;
end;
if (j==1); echo on; end
mse_av = mse_av + mse;
echo off;
end;
echo on;
mse_av=mse_av/Num_of_Realizations;
%Plotting Commands
% k=[1:N-2*K];
% plot(k,mse(k))
k=[1:11];
stem(k,estimated_c(k))
hold all
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %Binary Step Size Least Mean Square Algorithm
% Here, we have two step sizes calculated from 2 values, delta and deviation. When the error
% increases from the previous value of error step size is delta+deviation. And when the
% error decreases from its previous value step size is delta-deviation. It has been found
% that this converges nearly as fast as NLMS algorithm.
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo on
N=500;
K=5;
actual_isi=[0.05 -0.063 0.088 -0.126 -0.25 0.9047 0.25 0.126 0.038 0.088];
sigma=0.01;
delta=0.09;
deviation=0.004;
Num_of_Realizations = 1000;
mse_av=zeros(1,N-2*K);
for j=1:Num_of_Realizations,
%information sequence
for i=1:N,
if (rand<0.5),
info(i)=-1;
else
info(i)=1;
end;
echo off;
end;
if (j==1);echo on ; end
%The Channel Output
y=filter(actual_isi,1,info);
for i=1:2:N, [noise(i) noise(i+1)]=gngauss(sigma); end;
y=y+noise;
%Now the Equalization part follows
estimated_c=[0 0 0 0 0 1 0 0 0 0 0]; %Initial Estimate of ISI
e_k1=0;
for k=1:N-2*K,
y_k=y(k:k+2*K);
z_k=estimated_c*y_k.';
e_k=info(k)-z_k;
if(e_k>e_k1)
estimated_c=estimated_c+(delta+deviation)*e_k*y_k;
elseif(e_k<=e_k1)
estimated_c=estimated_c+(delta-deviation)*e_k*y_k;
end
e_k1=e_k;
% estimated_c=estimated_c+delta*e_k*y_k;
mse(k)=e_k^2;
echo off;
end;
if (j==1); echo on; end
mse_av = mse_av + mse;
echo off;
end;
echo on;
mse_av=mse_av/Num_of_Realizations;
%Plotting Commands
k=[1:11];
stem(k,estimated_c(k))
% k=[1:N-2*K];
% plot(k,mse(k))
hold all
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %Binary Step Size Normalized Least Mean Square Algorithm
% Here, we have two step sizes calculated from a single value delta. When the error
% increases from the previous value of error step size is delta+0.01. And when the
% error decreases from its previous value step size is delta-0.01. It has been found
% that this converges nearly as fast as NLMS algorithm, plus an added
% advantage that the mean square error decreases as compared to NLMS
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo on
N=500;
K=5;
actual_isi=[0.05 -0.063 0.088 -0.126 -0.25 0.9047 0.25 0.126 0.038 0.088];
sigma=0.01;
delta=0.09;
deviation=0.004;
Num_of_Realizations = 1000;
mse_av=zeros(1,N-2*K);
for j=1:Num_of_Realizations,
%information sequence
for i=1:N,
if (rand<0.5),
info(i)=-1;
else
info(i)=1;
end;
echo off;
end;
if (j==1);echo on ; end
%The Channel Output
y=filter(actual_isi,1,info);
for i=1:2:N, [noise(i) noise(i+1)]=gngauss(sigma); end;
y=y+noise;
%Now the Equalization part follows
estimated_c=[0 0 0 0 0 1 0 0 0 0 0]; %Initial Estimate of ISI
e_k1=0;
for k=1:N-2*K,
y_k=y(k:k+2*K);
z_k=estimated_c*y_k.';
e_k=info(k)-z_k;
n=norm(y_k);
if(e_k>e_k1)
estimated_c=estimated_c+(delta+deviation)*e_k*y_k/n;
elseif(e_k<=e_k1)
estimated_c=estimated_c+(delta-deviation)*e_k*y_k/n;
end
e_k1=e_k;
% estimated_c=estimated_c+delta*e_k*y_k;
mse(k)=e_k^2;
echo off;
end;
if (j==1); echo on; end
mse_av = mse_av + mse;
echo off;
end;
echo on;
mse_av=mse_av/Num_of_Realizations;
%Plotting Commands
k=[1:11];
stem(k,estimated_c(k))
% k=[1:N-2*K];
% plot(k,mse(k))
hold all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Least Mean Squares Algorithm based Equalizer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo on
N=500;
K=5;
actual_isi=[0.05 -0.063 0.088 -0.126 -0.25 0.9047 0.25 0.126 0.038 0.088];
sigma=0.01;
delta=0.09;
Num_of_Realizations = 1000;
mse_av=zeros(1,N-2*K);
for j=1:Num_of_Realizations,
%information sequence
for i=1:N,
if (rand<0.5),
info(i)=-1;
else
info(i)=1;
end;
echo off;
end;
if (j==1);echo on ; end
%The Channel Output
y=filter(actual_isi,1,info);
for i=1:2:N, [noise(i) noise(i+1)]=gngauss(sigma); end;
y=y+noise;
%Now the Equalization part follows
estimated_c=[0 0 0 0 0 1 0 0 0 0 0]; %Initial Estimate of ISI
for k=1:N-2*K,
y_k=y(k:k+2*K);
z_k=estimated_c*y_k.';
e_k=info(k)-z_k;
estimated_c=estimated_c+delta*e_k*y_k;
mse(k)=e_k^2;
echo off;
end;
if (j==1); echo on; end
mse_av = mse_av + mse;
echo off;
end;
echo on;
mse_av=mse_av/Num_of_Realizations;
%Plotting Commands
k=[1:11];
stem(k,estimated_c(k))
% k=[1:N-2*K];
% plot(k,mse(k))