0
$\begingroup$

enter image description hereImage shows the matlab code of lms algorithm.enter image description here

I am giving white noise as input to an adaptive filter which is initialized to zero (value of filter coefficients of adaptive filter is 0). I am getting a desired response $d(n)$ by passing white noise through an unknown channel of impulse response $h(n)$.

Now using LMS algorithm, I am trying to update the adaptive filter coefficients by using the equation $$w(n+1)=w(n)+\mu u(n) e(n)$$ where $\mu$ is the step size or adaptation speed of the algorithm, $u(n)$ is the white noise which is passed to a speaker and $e(n)$ is the difference between desired response and estimated response.

Even after $n$ number of iterations, why is that the error signal, which is the difference between desired response and estimated response, not decreasing but remaining almost constant.

$\endgroup$
12
  • $\begingroup$ Would be helpful if you can tell the values of mu, and make sure you are using the same u[n] sequence for input to adaptive filter as well as to the speaker. If not then the error will not converge. Even better, if you could post the block diagram of your setup. This way it would also help improve your understanding (a picture is worth 1000 words..) $\endgroup$
    – jithin
    Mar 11 '20 at 6:06
  • $\begingroup$ The value of mu is changed from 0.01 to 0.1.Still, there is no change in the error signal $\endgroup$
    – Deepa
    Mar 11 '20 at 6:24
  • $\begingroup$ There seems to be delay from speaker input till computation of d[n] which is not taken into account. Instead of white noise, can you try giving a known signal, say, all 1s (constant amplitude signal) as a sanity check? $\endgroup$
    – jithin
    Mar 11 '20 at 9:20
  • $\begingroup$ Are you sure that the model of the adaptive filter matches the order of the unknown filter characterized by $h(n)$? $\endgroup$
    – fibonatic
    Mar 11 '20 at 9:35
  • $\begingroup$ @jithinrj The response that I am getting is that there is always one sample delay between the desired signal and the signal estimated by the adaptive filter, i.e the adaptive filter is producing the estimate of the desired sample after 1 sample delay.Won't the adaptive filter able to adapt to the delay produced by the unknown channel h(n) $\endgroup$
    – Deepa
    Mar 11 '20 at 9:51
2
$\begingroup$

As mentioned in the comment, I modified the code given here and was able to adapt the LMS filter with error tapering to zero. The only assumption I made is that (since I am not an audio expert and do not know how the channel from speaker to the microphone would look like), I assumed a 10 tap channel with only first 3 non-zero values (multi-path reflection from walls). OP is free to use a channel of his/her choice. Using this I generated 'actual_fb_path' by convolving white-noise with assumed channel. If I get access to 'actual_fb_path' it would be great. I would request OP to modify this as per the system model to see if it adapts to the delay.

clc
clear all
close all
training_input = rand(1,100);
h_actual = [0.8 0.3 0.05 zeros(1,7)]; %channel assumption
actual_fb_path = conv(training_input, h_actual);
d = actual_fb_path;
mu = 0.1;
%ha = lms(40,mu);
%[y,e] = filter(ha, training_input, d);
lms = dsp.LMSFilter;
lms.StepSize = mu;
lms.Length = 10;
[y,e]=lms([training_input zeros(1,9)]', d');
%subplot(2,1,1)
N=length(training_input) + length(h_actual)-1;
figure()
plot(1:N,d,'r',1:N,y,'b',1:N,e,'g')
title('System')
legend('Desired','Output','Error')

enter image description here

$\endgroup$
5
  • $\begingroup$ When I tried convolving the white noise with an impulse response similar to your's,I am getting error values going down to 0.However,the feedback samples obtained in the practical scenario(white noise passed through speaker), it fails to give the desired result.Since I can't attach excel sheet containing actual data samples here,its difficult to show the scenario.I will attach the matlab figure I have obtained. $\endgroup$
    – Deepa
    Mar 13 '20 at 6:12
  • $\begingroup$ @Deepa it may happen that the noise itself is high. Can you just sample the noise alone from speaker (without giving any input to it)? How does that look? $\endgroup$
    – jithin
    Mar 14 '20 at 4:49
  • $\begingroup$ Did you meant the white noise which is given to the speaker $\endgroup$
    – Deepa
    Mar 16 '20 at 5:48
  • $\begingroup$ Not the white noise. Do not give any input to speaker. $\endgroup$
    – jithin
    Mar 16 '20 at 7:04
  • $\begingroup$ The data samples obtained from the speaker is almost constant random values $\endgroup$
    – Deepa
    Mar 17 '20 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.