LMS is widely used in speech enhancement, and is one of the most common algorithms, which is also the theoretical basis or component of many more complex algorithms, such as the important method--GSC (generalized sidelobe cancellation) in array speech enhancement. The LMS algorithm extends from the original version to many variant structures, such as normalized LMS, variable step LMS, and so on. These are some of the optimizations that have been made to the iterative parts of the LMS.
Recently saw the realization of the GSC, the previous written procedures again looked again, almost consolidated again, I hope I can not forget the I have this broken memory, sometimes really very helpless!
The first is the theoretical part derivation, which is not detailed here, briefly giving the process:
Adaptive linear combination and LMS schematic diagram
The MATLAB implementation program is as follows (variable step LMS):
clear;% working space cleanup
Close all% ...
sysorder=5;% Number of Taps ...
samples_per_period=50; % Cycle Sampling frequency
n=10*samples_per_period-1;% Total Sample Count
Signal=cos (Pi*0.02*[0:n-1]) +sin (2*pi*0.02*[0:n-1]) +cos (3*pi*0.02*[0:n-1]) +sin (4*pi*0.02*[0:n-1]) +cos (5*pi*0.02 *[0:n-1]) ...
+sin (6*pi*0.02*[0:n-1]) +cos (7*pi*0.02*[0:n-1]) +sin (8*pi*0.02*[0:n-1]) +cos (9*pi*0.02*[0:n-1]);% initial input signal/desired signal
Figure ()% first sub-graph of the drawing 1
Subplot (2,1,1);
Plot (signal);
Grid
Title (' Ideal input for adaptive filter ');
nvar=0.5;% Noise Variance
NOISE=NVAR*RANDN (1,n);% noise signal
x=signal+noise;% input signal with additive noise
Delayx=[0 x];% Input Signal delay
Subplot (2,1,2); the second sub-figure of the graph 1
Plot (Delayx);
Grid
Title (' Noise input for adaptive filter ');
Signal=[signal 0];
%m=32;% Filter Length
M=length (signal);%m to receive data length
mu=0.002;% Iteration Step
Totallength=size (x,1);% step
N=size (signal,2);%60 nodes as training sequences
The start of the% algorithm
W=zeros (sysorder,1);% initialization
For n=sysorder:n
Y (1:sysorder) =x (1:sysorder); % first five values are assigned to original values
Y (n) =x (n-sysorder+1:1:n) *w; % System Output
E (n) =y (n)-signal (n); % system error
If n<200
mu=0.0032;
Else
mu=0.0015;
End
Step=mu./(1+abs (E (n)). ^2);
W=w+step*x (n:-1:n-sysorder+1) ' *e (n);% iterative equation
End
Y=-y;
%initial_status=initlms (Zeros (1,m), mu),% filter Set initial value
%[y,e,initial_status]=adaptlms (x,signal,initial_status);%lms Adaptive Filter Output
Figure ()% first sub-graph of the drawing 2
Subplot (2,1,1);
Plot (0:n-1,y, ' R ', 1:n, signal, ' B ');
Grid
Title (' Comparison of the predicted signal to the actual signal ');
Legend (' Predictive signal ', ' actual signal ');
error=signal-y;% Output Error Signal
Subplot (2,1,2); the second sub-figure of the graph 2
Plot (error);
Grid
Title (' Predictive error of adaptive filter ');
The results of the simulation tracking filter graph show that the predicted signal can track the real signal transformation after the LMS convergence, and remove the noise signal (the signal with noise is not mapped). Where the prediction error is caused by misalignment of the signal, a delay is introduced in the program:
LMS Algorithm de-noising