hi ive tried writting an lms code as a part of my final year proj.The code models a
general near end - far end system. With the far end mic only transmitting an echo
signal.However the error signl which is supposed to be zero is more or less same as the desired
signal??.
Ive copied the code below.I would really appreciate if someone can help me find out the flaws
in this code.
*****************************MAIN******************************
clear all
clc
[mic_near,fs1]=wavread('D:\Documents and Settings\Dmello\My
Documents\Downloads\Music\bro.wav');
spkr_far=mic_near;
for i=1:length(mic_near)
if i<=94
mic_far(i)=0;
else
mic_far(i)=0.5*spkr_far(i-94);
end
end
af_input=spkr_far;
af_desired=mic_far;
af_init=zeros(1,100);
[v_c ,spkr_near]=lms_sys2(af_input,af_desired,af_init);
subplot(2,1,1),plot(mic_far);
title('mic');
subplot(2,1,2),plot(spkr_near);
wavwrite(spkr_near,fs1,'D:\Documents and Settings\Dmello\My
Documents\Downloads\Music\nearspkr.wav');
figure
plot(v_c);
**************************LMS SYSTEM****************************
function [v_c,e] = lms_sys(v_inp, v_des, v_c_init)
c_len=length(v_c_init);
v_c=v_c_init;
len=length(v_inp);
%TRAINING
N=1000 ;
for n = c_len : N
n=n
u = v_inp(n:-1:n-c_len+1) ;
y(n)= v_c * u;
e(n) = v_des(n) - y(n) ;
if n < 20
mu=0.32;
else
mu=0.15;
end
v_c = v_c + mu * u' * e(n) ;
end
for n = N+1 : len
u = v_inp(n:-1:n-c_len+1) ;
y(n) = (v_c) * u ;
e(n) = v_des(n) - y(n) ;
end
PS:IVE ALSO TRIED USING SINGLE STEPSIZE TO NO AVAIL
THANKING YOU

(You need to be a member of echocancel -- send a blank email to echocancel-subscribe@yahoogroups.com )