LMS Adaptive Filtering Algorithm Based on Particle Swarm and Sparrow Search-with Code

LMS Adaptive Filtering Algorithm Based on Particle Swarm and Sparrow Search


Abstract: Among the adaptive filtering algorithms, the LMS algorithm is one of the most commonly used algorithms, because it has the
characteristics However, the LMS algorithm also has disadvantages, such as slow convergence speed and low convergence accuracy, which affect
the application . Using the particle swarm optimization algorithm and the sparrow search algorithm to improve the LMS algorithm can turn the LMS filter design into a problem of optimizing the LMS filter parameters, and use the optimization ability of the particle swarm optimization algorithm to obtain the global optimal solution for the filter parameters. In this way, the convergence performance of the LMS filtering algorithm can be improved, thereby improving the filtering performance.

1. LMS adaptive filtering algorithm

The basic structure of the LMS filter is shown in Figure 1. As shown in Figure 1, this figure is the basic block diagram of the LMS filter:

insert image description here

Figure 1. Basic structure of LMS filter

When initializing, such as formula (1):
w ( 0 ) = w ( 0 ) = [ 000...0 ] T w(0)=w(0)=[0 0 0 ... 0]^Tw(0)=w(0)=[000...0]T
When k ≥ 0, such as formula (2), formula (3)
e ( k ) = d ( k ) − x T ( k ) w ( k ) (2) e(k) = d(k) - x ^T(k)w(k) \tag{2}e(k)=d(k)xT(k)w(k)(2)

w ( k + 1 ) = w ( k ) − 2 u e ( k ) x ( k ) (3) w(k+1) =w(k)-2ue(k)x(k)\tag{3} w(k+1)=w(k)2ue(k)x(k)(3)

Among them, (k) is the instantaneous error, u is the convergence factor, e(k) is the error signal, and w(k) is the filter coefficient. According to the gradient characteristics, w(k) will be automatically adjusted in each iteration operation, and the mean value E [ e 2 ( k ) ] E[e^2(k)] step by stepAnd [ e2 (k)]minimization,E [ e 2 ( k ) ] E[e^2(k)]And [ e2 (k)]is the minimum mean square error.

2. Application of adaptive filtering in noise reduction

When adaptive filtering is applied in noise reduction applications, its structural block diagram is shown in Figure 2.

insert image description here

Figure 2. Signal noise reduction structure

It is different from the adaptive filter structure seen. Signal x ( k ) x(k)x ( k ) subject to noisen 1 ( k ) n_1(k)n1( k ) influence. And the signaln 2 ( k ) n_2(k)n2( k ) is the signal associated with the noise, it can be measured signal. n 2 ( k ) n_2(k)n2( k ) is also used as the input signal of the adaptive filter, the disturbed signalx ( k ) + n 1 ( k ) x(k) + n_1(k)x(k)+n1( k ) as the desired signal.

Output signal y ( k ) y(k)y ( k ) and input signaln 2 ( k ) n_2(k)n2( k ) mathematical relationship according to Figure 1 is formula (4)
y ( k ) = ∑ l = 0 N wln 2 ( k − l ) (4) y(k) = \sum_{l=0}^{N }w_ln_2(kl)\tag{4}and ( k )=l=0Nwln2(kl)( 4 )
According to the mean square error equation, the formula (5) can be obtained:
E [ e 2 ( k ) ] = E [ x 2 ( k ) ] + E [ n 1 ( k ) − y ( k ) ] 2 (5) E[e^2(k)] = E[x^2(k)] + E{[n_1(k) - y(k)]^2}\tag{5}And [ e2(k)]=E [ x2(k)]+E[n1(k)y ( k ) ]2( 5 )
Ifx ( k ) x(k)x ( k ) andn 1 ( k ) n_1(k)n1( k ) andn 2 ( k ) n_2(k)n2( k ) is irrelevant, then the minimum MSE MSEof the functionM S E formula (6)
ξ min = E [ e 2 ( k ) ] = E [ x 2 ( k ) ] (6) \xi_{min} = E[e^2(k)] = E[x ^2(k)]\tag{6}Xmin=And [ e2(k)]=E [ x2(k)]( 6 )
wherex ( k ) x(k)x ( k ) is the signal we want to filter.

3. Improvement of LMS filter algorithm by particle swarm algorithm

The update equations shown in Equations 2 and 3 are the most important working steps of the LMS algorithm. According to the gradient characteristic E [ e 2 ( k ) ] E[e^2(k)]And [ e2 (k)]will continue to tend to the minimum mean square error. in. The following formula (7) can be deduced from formula 2.
e ( k + 1 ) = d ( k + 1 ) + x T ( k + 1 ) [ w ( k ) − 2 ue ( k ) x ( k ) ] (7) e(k+1) = d(k +1) + x^T(k+1)[w(k)-2ue(k)x(k)]\tag{7}e(k+1)=d(k+1)+xT(k+1)[w(k)2ue(k)x(k)](7)
e ( k ) e(k) e ( k ) is the instantaneous error. According to formula 7, the convergence factor 2u determinesE [ e 2 ( k ) ] E[e^2(k)]And [ e2 (k)]minimum value. Many studies are aimed at 2u, by dynamically adjusting 2u so that the value isE [ e 2 ( k ) ] E[e^2(k)]And [ e2 (k)]steps to the minimum, thus improving the convergence. The literature [1] uses the optimization ability of particle swarm algorithm, so thatE [ e 2 ( k ) ] E[e^2(k)]And [ e2 (k)]is minimized in each iteration to achieve the optimal convergence effect of LMS filtering, thereby improving the ability of filtering and noise reduction.

First, the convergence factor u is set as the particle in the search space, then the adjustment operation on u is transformed into finding the optimal position of the particle in the space.

According to the formula (7), this article sets the fitness function, as the following formula (8)
F = min ( e ( k + 1 ) ) (8) F = min(e(k+1)) \tag{8}F=m i n ( e ( k+1))( 8 )
The fitness function can realize the minimization of the instantaneous error, so that the minimum mean square error MSE reaches the minimum.

4. PSO-LMS Algorithm Experiment

The analog data is generated by using a sinusoidal signal plus noise, and the data is shown in the figure below:

insert image description here

The comparison chart after the original LSM and PSO-LSM filtering is as follows and the absolute error sum is used as the evaluation standard:
insert image description here

insert image description here

From the results, the improved LMS is obviously better than the basic LMS filter, the filtered signal is closer to the original signal, and the error is smaller.

5. SSA—LMS Algorithm Experiment

According to the same principle, the LMS filter algorithm is improved by using the sparrow search algorithm

The specific principle of the sparrow search algorithm refers to the blog: https://blog.csdn.net/u011835903/article/details/108830958.

The test results are as follows:

insert image description here

insert image description here

It can be seen that the improvement of the sparrow search algorithm to the LMS filter is still relatively obvious.

Running PSO-LMS and SSA-LMS simultaneously gives the following results:

insert image description here

It can be seen that the effect of SSA-LMS is better, and the error is smaller.

6. References

[1] Zhao Yixiao, Wang Lei. Application of Particle Swarm Based LMS Algorithm in Signal Filtering and Noise Reduction [J]. Microcomputer Applications, 2017,33(09):71-74.

7. Matlab code

Particle Swarm Based LMS Filtering Algorithm
Based on Sparrow Search Algorithm LMS Filtering Algorithm
Profile Introduction

Guess you like

Origin blog.csdn.net/u011835903/article/details/110529694#comments_26742750