Document 14081121

advertisement
International Research Journal of Computer Science and Information Systems (IRJCSIS) Vol. 2(5) pp. 65-72, July,
2013
Available online http://www.interesjournals.org/IRJCSIS
Copyright©2013 International Research Journals
Review
Implementation of multi swarm PSO algorithm
for ripples reduction in digital fir low pass filter
*
Uday Kumar P and Kaladhara Sarma GRC
Research Scholar in Electronics and Communication Engineering, Shri Venkateshwara University, Gajraula, Amroha 244236, U.P., India
Accepted June 25, 2013
Engineers seek to design a digital FIR filter in such a way preferably to avoid the effect of errors in
Signal Processing. There are several methods to design a FIR filter but a problem exists to determine
the sample value in the transition zone. Obviously, the optimization techniques such as Ant colony
algorithm, Bees algorithm, Firefly algorithm, and Genetic Algorithm method cannot guarantee that the
interpolator is the optimal sampling point. This method is complex in structure which takes longer time
in operation and suffers from local optimal solutions. In this paper multiple swarm with multiple
elements of PSO algorithm is used to determine the frequency response of Digital FIR low pass filter,
which provides optimal filter coefficients with fast convergence speed such that error function is
minimized, when compared the errors obtained from windowing technique. PSO algorithm is one of the
efficient ways to improve the stop band attenuation such that the samples are interpolated near the
discontinuity and reduces the errors. The performance of this PSO algorithm is compared with the
conventional window techniques has been verified via computer simulations using MATLAB 7.0.
Keywords: PSO, MSE, filter ripples, multiple swarm and window techniques.
INTRODUCTION
Particle Swarm Optimization is a population based
stochastic optimization technique developed by Dr.
Eberhart and Dr. Kennedy in 1995, inspired by social
behavior of bird flocking or fish schooling (Yolian and
Cheng, 2008). In PSO the potential solutions, called
particles, fly through the problem space by following the
current optimum particles (Junliang and Xinping, 2008).
Each particle keeps track of its coordinates in the
problem space which are associated with best solutions
(fitness) it has achieved so far. This value is called Pbest.
When a particle takes all the population as its topological
neighbors. The best value is called global best (Gbest).
The particle swarm optimization concepts consist of, at
each time step, changing the velocity of each particle
towards its Pbest location. PSO has no potential
evolution operators such as crossover and mutation
(Angeline, 1998).
Mathematical analysis of fir low pass filter
The frequency response of a linear phase FIR filter is
given by
k
H (ω ) =
∑
h ( n )e −
jω n
----(1)
i =1
Where h(n) is the real valued impulse response of filter,
N+1 is the length of filter and ω is frequency according
to the length being even and odd and the symmetry being
an even and odd four types of FIR filters described. The
linear phase is possible if the impulse response h(n) is
either symmetric(i.e. h(n) =h(N-n) or is anti symmetry
h(n)=-h(N-m) for 0<=n<=N.
In general the frequency response [5] for type1 FIR
filter can be expressed in the form
~
H ( e j ω ) = e − jn ω / 2 H
----(2)
~
Where amplitude response
zero response, is given by
H ( ω ), also called the
~
N /2
H (ω) = h( N / 2) + ∑n=1 h( N / 2 − n)cos(ωn) ----(3) the amplitude
*Corresponding Author Email: udayexplore@gmail.com
response for the type 1 linear phase FIR filter (Mitra,
66 Int. Res. J. Comput. Sci. Inform. Syst.
2006)
(using
the
notation
N=2M)
is
expressed
∑ a ( k ) cos(ω k )
H =
k =0
as
---(4)
Where a(0)=h(M) and a(k) = 2h(M-k), 1<=k<M
The design of a linear phase FIR filter with least mean
square error criterion, we find the filter coefficients a(k)
such that error is minimized. Corresponding to the
coefficients the filter coefficients are obtained as shown
by the equations.
The Least mean square design function for this design
is given as
∑
Є=
k
i =1
W (ωi )[ A(ωi − D(ωi )]
----(5)
For type 1 FIR filter the amplitude response A(w) is a
function of a(k) to arrive at the minimum value of є , we
set
0<=k<=M
∂ ∈ / ∂a ( k ) = 0
Which results in a set of (M+1) linear equations that
can be solved for a(k)
For the type 1 the expression for mean square error
(Mitra, 2006) is ε expressed as
k
∑
Step 2
M
~
M
{W (ωi )[∑k =0 a(k )cos(ωi k ) − D(ωi )]}^ 2 -----(6)
i =1
A similar formation can be derived for the other three
types of linear phase FIR filters. This Design approach
can be used to design a linear phase FIR filter with
arbitrarily shaped desired response. Where D(w )is the
frequency response.
Quantitative approach and implementation of PSO
algorithm
Particle Swarm Optimization (PSO) algorithm is a
population based optimization algorithm (Kennedy and
Ebhert, 1995). Its population is called a swarm and each
individual is called a particle. Each particle flies through
the solution space to search for global optimization
solution. The implementation of PSO algorithm (Hui,
2005; System Reliability Enhancement using Particle
Swarm Optimization (PSO), 2008) for optimizing the filter
coefficients is given as follows.
Initial population (swarm) is generated where each
particle in the swarm is a solution vector containing M=4
elements, then initial population can be expressed as
Ai = [Ai(1), Ai(2), Ai(3), Ai(4) ] where i= 1,2,3,4…..
Ai(1)
Ai(2)
Ai(3)
Ai(4)
A1=[ 0.0121 0.0382 -0.4573
0.564 ]
A2=[ 0.2451 0.4567
-0.1489
0.732 ]
A3=[ 0.1753 -0.2198
0.3134
-0.457 ]
A4=[ 0.3477 -0.4980
0.1235
0.654 ]
At Initial, every particle coefficients will act as
Personal best
‘A1’ particle coefficients may be Pbest1
‘A2’ particle coefficients may be Pbest2
‘An’ particle coefficient may be Pbestn.
Every particle position is updated in the following
sequence
‘A1’Particle is updated as A11, A12, A13……... A1n.
‘A2’Particle is updated as A21, A22, A23……...A2n.
‘Am’Particle is updated as Am1, Am2, Am3.. Amn.
Step 3
Initial velocities of each particle are written as follows
Vi= [Vi(1), Vi(2), Vi(3), Vi(4)] where i= 1,2,3,4…..
Vi(1)
Vi(2)
Vi(3)
Vi(4)
V1=[ 0.1401
0.3403 0.3405 0.5604 ]
V2=[ 0.4502
0.6704 0.7801 0.4207 ]
V3=[ 0.9501
0.9802 0.6403 0.6304]
V4=[ 0.5603
0.4104 0.4701 0.5706 ]
Every particle velocity is updated in the following
sequence
‘V1’ Particle is updated as V11, V12, V13, …..V1n
‘V2’ Particle is updated as V21, V22, V23, .….V2n
‘Vm’ Particle is Updated as Vm1,Vm2,…..Vmn.
Step 4
Set iteration [4] count i=1.
Step 1
In Type I FIR filter, Mean square error expression is given
by
∑
k
M
{W (ωi )[∑k =0 a(k )cos(ωi k ) − D(ωi )]}^ 2
Step 5
i =1
Where M=No. of elements.
k=No. of particles.
Calculate Error value by using the equation (6) and place
them in adjacent in a function F
Kumar and Sarma 67
Error F=[E1, E2, E3, E4]
Where E1 is the error calculated from A1 particle,
similarly E2, E3, and E4 are the errors calculated from A2,
A3 and A4 particles respectively.
Here Substitute M=No. of elements=4 and Substitute
k=No. of particles=4
Error=
Updated Positions for 4 particles is as follows:
After expanding for number of iterations, Error is
calculated
from
‘A1’
particle
and
assign
as ”Pbest1”.Similarly for ‘A2’, ‘A3’ and ‘A4’ particles, error
is to be calculated and assigned as “Pbest2”, “Pbest3”,and
“Pbest4” respectively.
Step 8
Update position of A1 particle as A11 = A1 + V11;
Update position of A2 particle as A21 = A2 +V21;
Update position of A3 particle as A31 = A3 + V31;
Update position of a1 particle as A41 = A4 + V41;
k
k
Update Pbesti and Gbesti
K
K
K
K
Pbesti = Ai if C(Ai ) <C(Pbesti )
K
K
K
= Pbesti if C(Ai )>C(Pbesti )
Out of all particles which give min error gives the Gbest.
To calculate Global best
Step 9
Place all the errors or pbest values in a function F and
again calculate the error and find the error initial which is
minimum error before modification of position and
velocity called as Gbest .
A(1)
A(2) A(3) A(4)
Let F=[ Pbest1 Pbest2 Pbest3 Pbest4]
Minimum Error is obtained from function F called
“Gbest” before iteration and without modification of both
position and velocity of the particles.
Repeat step 5 to 9 for maximum no of times to get the
least possible error. The above steps from 1 to 9 are
implemented in four particles with four elements and it is
also extended to implement in six particles with six
elements, eight particles with eight elements and ten
particles with eight elements which are tabulated in table
3.
Step 6
Results of Frequency Response and Error PLOR for
Window Based Fir LPF Design
Update velocities of each particle using following relation
K+1
K
K
K
K
K
Vi = W*Vi + C1 *r1(Pbesti -ai ) +C2 *r2(Gbesti -ai )
K
th
Where Pbesti = best current position of the i particles,
K
th
Gbesti = Global best of i position among all
particles.
r1 and r2 = random digits between [0,1].
C1 and C2 = acceleration constants and W = inertia
weight typically selected in the range 0.1 to 2.
Updated velocities for 4 particles are as follows:
(1) Update velocity of A1 particle as
V11 = W*V1 + C1*r1*(Pbest1 - A1) + C2*r2*(Gbest1 - A1);
(2) Update velocity of A2 particle as
V21 = W*V2 + C1*r1*(Pbest2 – A2) + C2*r2*(Gbest2 – A2);
(3) Update velocity of A3 particle as
V31 = W*V3 + C1*r1*(Pbest3 – A3) + C2*r2*(Gbest3 – A3);
(4) Update velocity of A4 particle as
V41 = W*V4 + C1*r1*(Pbest4 – A4) + C2*r2*(Gbest4 – A4);
Step 7
Update position of each individual particle as
k+1
k+1
k
where i=1,2....M.
Ai = Ai +Vi
In this paper FIR filter of order 15 is implemented using
conventional methods like window method. The desired
response of the filter is specified by using the following
specifications.
Here Hamming, Rectangular and Kaiser have the
following filter specifications (The fourth edition of Digital
Signal Processing by Dr. P Ramesh Babu).
(1)Cutoff frequency ωc=0.3π,
(2) Filter length=15
(3) Passband gain (H1)=0dB common for Hamming,
Boxcar and Kaiser.
Stopband gain(H2)=-80dB for Hamming
=-76dB for Rectangular
=-82dB for Kaiser Windows (Figure 1)
In each case frequency response is obtained for
different windows like boxcar, hamming and Kaiser
Windows. The same specifications are also implemented
using Particle swarm optimization technique.
In all the cases the responses obtained is compared
with the desired response of the filter. In each case stop
band and pass band ripples, attenuate and transition
width, side lobe and main lobe width ,computational time
are observed. They are compared against each other and
performance of the filter is discussed
In the figure 2 below the error is plotted for different
windows these errors are compared and tabulated in the
68 Int. Res. J. Comput. Sci. Inform. Syst.
frequency response for window based methods
10
hamming window
boxcar
kaiser
0
-10
M a g n it u d e in d B
-20
-30
-40
-50
-60
-70
-80
-90
0
0.1
0.2
0.3
Figure 1.Frequency
Techniques
0.4 0.5 0.6 0.7
Normalised frequencyω/π
response
for
0.8
0.9
window
1
based
Error plot
36
Hamming error
Boxcar error
Kaiser error
34
Error Magnitude
32
30
28
26
24
0
2
4
6
8
10
12
Number of iterations
14
16
18
20
Figure 2. Error plot for window based methods
table 1. It is observed that for filter length 15 the hamming
window has Minimum error as 24.49. This error is the
minimum value compared with the boxcar and Kaiser
windows. In this paper, this minimum error is further
Kumar and Sarma 69
Table 1. Filter specifications for different window based methods
SPECIFICA-TIONS
Filter Length
Hamming window
Rectangular window
Kaiser Window
Stop band gain (H2)
dB
7
Pass band gain(H1)
dB
-0dB
Cut-off frequency
(ωc)
Error in pass band and
in stop band
-70dB
0.3
16.958
11
-0dB
-80dB
0.3
17.698
15
-0dB
-80dB
0.3
24.497
7
-0dB
-88dB
0.3
27.486
11
-0dB
-60dB
0.3
32.588
15
-0dB
-76dB
0.3
34.051
7
-0dB
-80dB
0.3
26.750
11
-0dB
-88dB
0.3
31.957
15
-0dB
-82dB
0.3
33.624
Table 2. Comparison of main lobe and side lobe of window based method and PSO window methods (The fourth edition of
Digital Signal Processing by Dr. P Ramesh Babu)
Techniques
PSO
Hamming
Rectangular
Kaiser
Main Lobe
-2dB
0 dB
0 dB
0 dB
Side Lobe
-22 dB
-60 dB
-20 dB
-36
Pass band Gain
-3 dB
0 dB
0 dB
0 dB
Stop band Gain
-58 dB
-80 dB
-76 dB
-82 dB
Error in pass and stop bands
3.8320
24.497
34.051
33.624
Four particles with four elements Frequency Response
and Error Plot
These ripples are again compared with the ripples
which is calculated using PSO algorithm of ten particles
with eight elements as shown in Table 2 and these
ripples are reduced when compared to the window
based techniques in designing digital FIR low pass filter .
In this PSO algorithm is compared with the window
method. The following table Shows Accuracy parameters
like main lobe, side lobe, pass band gain, stop band gain
and execution time and it’s Comparison with windowing
techniques. This comparison is shown in table 2
This paper includes PSO Algorithm of four particles
with four elements is implemented
in digital FIR low
pass filter design and consequently obtained optimized
frequency response and reduced errors in error plot as
shown in figure 3.similarly the number of particles and
number of elements are increased so that a optimal
solution in error may obtained in digital FIR low pass filter
design.
Comparisons of window based fir low pass filter for
different specifications
Ten particles with Eight
Response and Error Plot
The following table 2 shows the digital FIR filter of order
15 has different performance parameters like pass band
gain, stop band gain and error in the pass band and stop
band for the conventional window based FIR filters.
By varying the Number of particles and Number of
iterations error evaluation is studied in case of PSO
algorithm. It is also represented in table 3.
In this analysis as the number of iterations are
reduced with the particle swarm optimization algorithm.
In the above tabular column 1 different filter
specifications are calculated for conventional window
based methods and they are tabulated. For all the
window based methods a common cut off frequency is
proposed in designing the digital FIR low pass filter.
In this the pass band gain, stop band gain for different
windows are tabulated in Table 1. And ripples in pass
band and stop band are calculated and compared among
the Hamming window, Rectangular window and Kaiser
Window as shown in the Table 1.
Results of PSO for Different Particles with Multiple
Elements
elements
Frequency
70 Int. Res. J. Comput. Sci. Inform. Syst.
frequency response for 4 particles with 4 elements
10
hamming window
boxcar
kaiser
FR of LPF w/o PSO
FR of LPF wih PSO
0
-10
Magnitude in dB
-20
-30
-40
-50
-60
-70
-80
-90
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
Normalised frequenccy ω/ π
0.8
0.9
1
Error reduction sequence
Hamming error
Boxcar error
Kaiser error
Error Initial
Error final
25
Error M agnitude
20
15
10
5
0
0
20
40
60
80
100 120
Number of iterations
140
160
180
200
Figure 3. Four particles with 4 elements Frequency Response and Error
Plot
increased then the ripples in pass band and stop band is
reduced using PSO algorithm which is shown in the
Table 3.
PSO algorithm not only used in optimizing the filter
coefficients in digital FIR filter but also in various areas
like Training of neural networks, Identification of
Parkinson’s disease, Extraction of rules from fuzzy
networks, Image recognition Optimization of electric
Kumar and Sarma 71
Table 3. Comparison of Multiple particles
with Initial and final error for different No. of iterations
Initial Error obtained
before iteration
24.4385
Four Particles with Four elements
Six particles with six elements
23.5760
Eight particles with eight elements
24.4659
Ten particles with eight elements
24.4659
No. of iterations
performed
50
100
200
300
50
100
200
300
50
100
200
300
50
100
200
300
Time taken to complete
program execution
4.752980S
3.745467S
5.244427S
5.335895S
0.7543095
1.479987S
2.63669S
3.873976S
3.012755S
6.582142S
5.573579S
6.566271S
3.194571S
4.182840S
5.798826S
7.510866S
frequency response for 10 particles with 8 elements
10
hamming window
boxcar
kaiser
FR of LPF w/o PSO
FR of LPF wih PSO
0
-10
Magnitude in dB
-20
-30
-40
-50
-60
-70
-80
-90
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
Normalised frequency ω/ π
0.8
0.9
Error reduction sequence
Hamming error
Boxcar error
Kaiser error
Error Initial
Error final
35
Error Magnitude
30
25
20
15
10
5
0
0
20
40
60
80
100
120
Number of iterations
140
160
180
200
Figure 4.Ten particles with 8 elements Frequency Response and Error Plot
1
Final Error obtained after
iteration
6.8135
6.7961
6.8508
6.7017
3.9118
3.2288
2.9364
2.8896
5.3642
3.9453
3.7616
3.4112
5.8536
4.0606
3.8320
3.6764
72 Int. Res. J. Comput. Sci. Inform. Syst.
power distribution networks, Structural optimization,
Optimal shape and sizing design, Topology optimization,
Process
biochemistry,
System
identification
in
biomechanics
CONCLUSIONS
The information mechanism in PSO is significantly
different, because the whole population moves like a one
group towards an optimal area. In PSO, only gbest gives
out the information to others. PSO converges to the best
solution quickly and gives minimum error which is
compared with the conventional techniques as shown in
the figure 1 whose filter specifications are tabulated in the
table 1 and the error reduction for different particles are
shown in the figure 3 and 4 and its quantitative
information is tabulated in table 3. The frequency
response of PSO is better than the conventional methods
at the same time as the no. of iterations increases error is
reduced and the information is furnished in the table 3.
As the Number of coefficients are increased then
probability of reduction in error is getting reduced which
can be shown in figure 3 to 4 and observed in table 3.In
nd
this table 3 the Initial error is shown in 2 column for
th
different particles and Final error is shown in 5 column.
As the number of iterations increases then reduction of
error is consequently reduced. and The frequency
response of multiple particles with multiple elements are
compared with the conventional window based methods
in which pass band ripples and stop band ripples are
reduced particularly in PSO algorithm.
The main lobe and side lobe parameters of the
conventional methods and PSO algorithm are tabulated
in table 2 in which the transition width of the PSO
algorithm is getting narrow reaching to the ideal
condition.
As PSO is a purely random algorithm in which time
taken to compute the algorithm is large compared to the
conventional methods. However PSO does not have any
genetic operators like crossover and mutation. So, PSO
is better than genetic algorithm.
REFERENCES
Angeline P (1998). “Evolutionary Optimization versus Particle Swarm
Optimization: Philosophy and Performance Differences”, Evolutionary
Programming, of Lecture Notes in Computer Science, Springer,
1447(1998): 601-610.
Bo Li, Ren Yue Xiao (2007). “The particle swarm Optimization
algorithm: How to select the Number of iteration”, School of
mathematical Sciences, south china university.
Hui Li (2005). An Zhang; Min Zhao; et al. “Particle Swarm
Optimization
Algorithm
for FIR Digital Filters Design”, Acta
Electronica sinica. 33(7):1338-1341, 2005.
Junliang Li, Xinping Xiao (2008). ”Multiswarm and Multi - Best
Particle swarm Optimization algorithm”, School of sciences, wuhan
university. June 25-27, 2008.
Kennedy J, Ebhert RC (1995). “Particle swarm
optimization”,
proceedings of 1995 IEEE international conference on Neural
Networks, 4:1995
Mitra SK (2006). Digital
signal processing: A Computer based
approach, New York, McGraw-Hill, Third ed., 2006.
System Reliability Enhancement using Particle Swarm Optimization
(PSO) (2008). R Arya, Non-member, Dr S C Choube, Member Dr L
D Arya, , Dec 2008, IE(I) Jrnl–EL 89:2008
The fourth edition of Digital Signal Processing by Dr.P.Ramesh Babu.
Yolian Z, Cheng H (2008). ”Hybrid Optimization design of FIR filters,
IEEE the conference neural networks and signal proessing Zhenjing,
June 8-10, 2008
Download