Least mean squares (LMS) algorithms are a category of adaptive filter accustomed to mimic a desired filter by finding the filter coefficients that relate to producing the smallest amount mean squares of the error signal (difference between the specified and therefore the actual signal).

mfile to show acoustic echo cancellation taken from Matlab Website.

Here -> http://www.mathworks.com/products/dsp-system/demos.html?file=/products/demos/shipping/dsp/adaptecdemo.html

1. Clear all prior data

2. Set variable M for Impulse Response and fs for sampling frequency

3. Cheby2 filter returns the transfer function coefficients of four th-order lowpass digital Chebyshev type II filter with normalised stopband edge frequency between zero.1 and 0.7 & 20 decibels of stop-band attenuation down from the peak pass-band value. dfilt.df2t([zeros(1,6) B],A)
returns a discrete-time, direct-form II converse filter, <Hd, with dividend coefficients of an one by six matrix of zeros and divisor coefficients A. fvtool(Hd) opens FVTool and displays the magnitude responses for the dfilt filter object, Hd, or the array of dfilt filter objects.

 4Variable H is a filtered signal of H = filter((Hd,log(0.99*rand(1,M)+0.01).*sign(randn(1,M)).*exp(-0.002*(1:M))); filters the input data, Hd, employing a rational transfer function by the dividend constant log(0.99*rand(1,M)+0.01).*sign(randn(1,M)).*exp(-0.002*(1:M) , wherever randn(1, M) is any random number between one to M.

We Then Calculate the room Impulse Response as H = H/norm(H) *4; and Plot it

5. Load close to speech loads an built-in Matlab file named close to speech. we have a tendency to then take the signal of the wave file as v and initialise an number n that starts from one until the end length of v.

So primarily n contains the variables of signal v from to start to finish.

We calculate t by subtracting n by our sampling frequency.

Then we have a tendency to initiate axis to plot graph and set labels, title and color.

6. Load the built-in Matlab file far speech and extract its signal into variable x.we use filter to filter the input data, H, employing a rational transfer function by the dividend constant one and divisor co-efficient x is any random number between one to M.

7. We then take variable d which is the total of our filtered far speech signal and unfiltered input signal and zero.001 multiplied by a random number ranging between length of input signal until one. And Plot a graph and show it on screen.

8. Here, we initiate the variables required for lms and assign values to them.

9. Construct the Frequency-Domain Adaptive Filter.