Hi,
I am looking the code for an adaptive channel equalizer. I have to do system
identification in which i will pass a predefined signal or a recorded .wav file
and white Gaussain noise will be added to the signal and using MMSE techtnique
and LMS. I want to find the inverse of the channel so that the resulting output
should be the same as input. i.e H(z)=1/W(Z)
and
W(Z)H(Z)=1
I will be thankful to you if you kindly help me with this issue.
Regards
Zohaib
Adaptive Equalization
Started by ●August 20, 2008
Reply by ●August 22, 20082008-08-22
Hi,
>I am looking the code for an adaptive channel equalizer. I have to do system identification in which i will pass a predefined signal or a recorded .wav file and white Gaussain noise will be added to the signal and using MMSE techtnique and LMS. I want to find the inverse of the channel so that the resulting output should be the same as input. i.e H(z)=1/W(Z)
>
>and
> W(Z)H(Z)=1
>I will be thankful to you if you kindly help me with this issue.
>
>Regards
>
>Zohaib
Hi Zohaib,
this is a sample code for adaptive system identification using the NLMS algorithm:
%%%%%%%%%%%%adaptive system identification%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%Manolis Tsakiris%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
%simulation length
N = 1000;
%channel to be identified
M = 9;
wo = randn(M,1);
wo = wo / norm(wo);
%excitation signal
u = randn(1,N);
%channel output
y = filter(wo,1,u);
%additive noise to the channel output
SNR = 30;
var_v = var(y) * 10^(-SNR/10);
v = var_v^0.5 * randn(1,N);
%desired signal
d = y + v;
%NLMS adaptive system identification
w = zeros(M,1);
u_regressor = zeros(1,M);
step = 0.5;
epsilon = 10^(-6);
msd = zeros(1,N);
for k = 1 : N
u_regressor = [u(k) u_regressor(1:M-1)];
e = d(k) - u_regressor * w;
w = w + step * u_regressor' * e / (u_regressor * u_regressor' + epsilon);
msd(k) = (w-wo)' * (w-wo);
end
figure;
plot(10*log10(msd));
ylabel('MSD(dB)');
xlabel('iterations');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
And this is a sample code for adaptive channel equalization:
%%%%%%%%%adaptive channel equalization%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%Manolis Tsakiris%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
%simulation length
N = 1000;
%channel length
M = 5;
%number of independent trials
T = 100;
cascade_impulse_response = zeros(1,2*M-1);
for j = 1 : T
%training signal
u = randn(1,N);
%channel to be equalized
c = randn(M,1);
c = c / norm(c);
%channel output
z = filter(c,1,u);
%additive noise to the channel output
SNR = 30;
var_v = var(z) * 10^(-SNR/10);
v = var_v^0.5 * randn(1,N);
%input to the equalizer
x = z + v;
%NLMS channel equalization
w = zeros(M,1);
x_regressor = zeros(1,M);
step = 0.1;
epsilon = 10^(-6);
for k = 4 : N
x_regressor = [x(k) x_regressor(1:M-1)];
e = u(k-3) - x_regressor * w;
w = w + step * x_regressor' * e / (x_regressor * x_regressor' + epsilon);
end
cascade_impulse_response = cascade_impulse_response + conv(w,c)';
display(j);
end
figure;
stem(cascade_impulse_response/T);
title('cascade channel-equalizer impulse response');
xlabel('taps');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
you can load both codes at two different .m files in your MATLAB engine and run them.
Manolis
>I am looking the code for an adaptive channel equalizer. I have to do system identification in which i will pass a predefined signal or a recorded .wav file and white Gaussain noise will be added to the signal and using MMSE techtnique and LMS. I want to find the inverse of the channel so that the resulting output should be the same as input. i.e H(z)=1/W(Z)
>
>and
> W(Z)H(Z)=1
>I will be thankful to you if you kindly help me with this issue.
>
>Regards
>
>Zohaib
Hi Zohaib,
this is a sample code for adaptive system identification using the NLMS algorithm:
%%%%%%%%%%%%adaptive system identification%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%Manolis Tsakiris%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
%simulation length
N = 1000;
%channel to be identified
M = 9;
wo = randn(M,1);
wo = wo / norm(wo);
%excitation signal
u = randn(1,N);
%channel output
y = filter(wo,1,u);
%additive noise to the channel output
SNR = 30;
var_v = var(y) * 10^(-SNR/10);
v = var_v^0.5 * randn(1,N);
%desired signal
d = y + v;
%NLMS adaptive system identification
w = zeros(M,1);
u_regressor = zeros(1,M);
step = 0.5;
epsilon = 10^(-6);
msd = zeros(1,N);
for k = 1 : N
u_regressor = [u(k) u_regressor(1:M-1)];
e = d(k) - u_regressor * w;
w = w + step * u_regressor' * e / (u_regressor * u_regressor' + epsilon);
msd(k) = (w-wo)' * (w-wo);
end
figure;
plot(10*log10(msd));
ylabel('MSD(dB)');
xlabel('iterations');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
And this is a sample code for adaptive channel equalization:
%%%%%%%%%adaptive channel equalization%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%Manolis Tsakiris%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
%simulation length
N = 1000;
%channel length
M = 5;
%number of independent trials
T = 100;
cascade_impulse_response = zeros(1,2*M-1);
for j = 1 : T
%training signal
u = randn(1,N);
%channel to be equalized
c = randn(M,1);
c = c / norm(c);
%channel output
z = filter(c,1,u);
%additive noise to the channel output
SNR = 30;
var_v = var(z) * 10^(-SNR/10);
v = var_v^0.5 * randn(1,N);
%input to the equalizer
x = z + v;
%NLMS channel equalization
w = zeros(M,1);
x_regressor = zeros(1,M);
step = 0.1;
epsilon = 10^(-6);
for k = 4 : N
x_regressor = [x(k) x_regressor(1:M-1)];
e = u(k-3) - x_regressor * w;
w = w + step * x_regressor' * e / (x_regressor * x_regressor' + epsilon);
end
cascade_impulse_response = cascade_impulse_response + conv(w,c)';
display(j);
end
figure;
stem(cascade_impulse_response/T);
title('cascade channel-equalizer impulse response');
xlabel('taps');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
you can load both codes at two different .m files in your MATLAB engine and run them.
Manolis
Reply by ●January 14, 20092009-01-14
i want to ask how we can running simulation with m-file (not simulink) and
getting output from input in some range? ie : i want output coordinate (x,y)
for each input in line Y=x and i want it for x= 0 until x = 5.
where do i state it in my program, in matlab window or in m-file.
anyone be kind to give me example
thx b4
where do i state it in my program, in matlab window or in m-file.
anyone be kind to give me example
thx b4
Reply by ●January 19, 20092009-01-19
u can do both but it's elegant if u use m-files!! open a new mfile and
save it with a name (say, mfile.m)!! write ur code there
x=[0:0.1:5]; %x vector ocnsists of values from 0 to 5 with step 0.1
y=x;
plot(x,y);
next go to matlab command window & run ur code by simply typing mfile
and hiting enter!!
On 13/01/2009, bambang irawan wrote:
> i want to ask how we can running simulation with m-file (not simulink) and
> getting output from input in some range? ie : i want output coordinate
> (x,y) for each input in line Y=x and i want it for x= 0 until x = 5.
>
> where do i state it in my program, in matlab window or in m-file.
> anyone be kind to give me example
>
> thx b4
save it with a name (say, mfile.m)!! write ur code there
x=[0:0.1:5]; %x vector ocnsists of values from 0 to 5 with step 0.1
y=x;
plot(x,y);
next go to matlab command window & run ur code by simply typing mfile
and hiting enter!!
On 13/01/2009, bambang irawan wrote:
> i want to ask how we can running simulation with m-file (not simulink) and
> getting output from input in some range? ie : i want output coordinate
> (x,y) for each input in line Y=x and i want it for x= 0 until x = 5.
>
> where do i state it in my program, in matlab window or in m-file.
> anyone be kind to give me example
>
> thx b4