DESIGN OF LINEAR PHASE LOW PASS FINITE IMPULSE RESPONSE FILTER BASED ON PARTICLE SWARM OPTIMIZATION ALGORITHM

Digital filtering is one of the main fundamental aspect of digital signal processing (DSP). Finite Impulse Response (FIR) digital filter design involves multi parameter optimization, on which the existing optimization algorithm may does not work efficiently. Particle Swarm Optimization (PSO) algorithm is a bio-inspired optimization algorithm which has been empirically demonstrated to perform well on many optimization problems. It is widely used to find the global optimum solution in a complex search space. This paper presents the design of linear phase low pass FIR filter using particle swarm optimization (PSO) algorithm and discuss the influence of changing the PSO algorithm parameters such as the inertia weight (w), cognitive (c1) and social (c2) on the FIR filter design problem. Also the linear phase low pass FIR filter has been designed using the conventional genetic algorithm (GA) and a comparison has been made. The simulation results show that PSO algorithm is better than the conventional GA with more rapidly convergence speed and better performance of the designed filter. The FIR filter design using PSO algorithm is simulated using MATLAB programming language version 7.


1-INTRODUCTION
Over the past several decades the field of Digital Signal Processing (DSP) has grown theoretically and technologically.In DSP, there is two important types of systems, the first type performs signal filtering in time domain and hence it is known as digital filters.The second type provides signal representation frequency domain and are known as spectrum analyzer.Digital filtering is one of the most powerful tools of DSP (1) .
The conventional approach of filter design is to select one of the standard polynomial transfer functions that satisfies the response specifications, followed by the implementation of

Diyala Journal of Engineering Sciences
135 the transfer function in one of the standard circuit structures.In many cases this approach is inadequate and an optimization is required (2 and 3) .
Particle swarm optimization (PSO) was developed by Kennedy and Eberhart (1995)   as a stochastic optimization algorithm based on social simulation models (4) .In PSO algorithm, each individual is called "particle", which represents a potential solution.The algorithm achieves the best solution by the variability of some particles in the tracing space.
The particles search in the solution space following the best particle by changing their positions and the fitness frequently, the flying direction and velocity are determined by the objective function.For improving the convergence performance of PSO, the inertia weight factor (w) is used by Shi and Eberhart (5) to control the impact on current particle by former particle's velocity.PSO algorithm has preferred global searching ability when is relatively large.On the contrary, its local searching ability becomes better when is smaller.Now the PSO algorithm with inertia weight factor was called standard PSO (6) .Due to its many advantages including its simplicity and easy implementation, the algorithm can be used widely in the fields such as function optimization, the model classification, machine study, neutral network training, the signal procession, vague system control and automatic adaptation control etc (7) .
Digital FIR filter presented in this paper have several of designs and implementations advantages, the phase response can be approaches to become linear, they are relatively easy to design since it has no stability problems, efficient to implement, and the DFT can be used in their implementation (2 and 8) .
This paper presents the design of linear phase low pass FIR filter using PSO.
Simulations have been done to illustrate the significant and effective impact of inertia weight (w), cognitive (c1) and social (c2) parameters on the FIR filter design using this algorithm.

2-RELATED WORKS
For related works concern with the design of linear phase low pass FIR filter, Kwaha et al. have been designed a low pass digital filter using the MATLAB toolbox based on the least mean square error criterion method (9) .Alessandro et al. have been presented a novel method for the design of FIR digital filters based on the successive approximation of vectors in which the components are approximated by sums of powers-of-two (10) .Liang and Xinjie have been used the genetic algorithm with an improved crossover and mutation operators to design linear phase FIR filter with low and median taps (11) .Sabah has been presented an efficient design algorithm for FIR digital filter with arbitrary amplitude and phase specifications using genetic algorithm (12) .Zhongkai et al. have been proposed a chaotic 136 particle swarm optimization (CPSO) algorithm for the design of FIR digital filters (13) .
Amanpreet and Ranjit have been presented the design of linear phase digital finite impulse response (FIR) filter using modified particle swarm optimization (MPSO) algorithm (14) .
Zhongkai and Hongyuan have been proposed the cultural particle swarm optimization (CPSO), a novel population-based search technique for the design of FIR digital filters (15) .Sangeeta et al. have been presented a novel and accurate method for designing linear phase digital FIR high pass filter by using evolutionary optimization based on improved particle swarm optimization (IPSO) (16) .Rajib et al. have been applied a novel craziness based particle swarm optimization (CRPSO) technique to the solution of constrained, multimodal, nondifferentiable, and highly nonlinear FIR band stop filter design problem to obtain the optimal filter coefficients (17) .Sangeeta et al. have been applied a novel particle swarm optimization algorithm (NPSO) to design FIR low pass filter with optimal filter coefficients (18) .Finally, Meisam and Ahmad have been carried out the application of the PSO to the design of FIR filter and a comparison with GA has been made (19) .
In this paper, a 21 tap symmetric linear phase low pass FIR filter with a 0.3π cutoff frequency has been designed using the standard PSO algorithm and a comparison with the GA has been made.Also the influence of changing the PSO algorithm parameters such as the inertia weight (w), cognitive (c1) and social (c2) on the FIR digital filter design problem has been discussed.

3-DIGITAL FIR FILTER
An FIR filter of length M with input x(n) and output y(n) is described by the difference equation, as following (20) : Where (bk) is the set of filter coefficients.Alternatively, we can express the output sequence as the convolution of the unit sample response h (n) of the system with the input signal.Thus: Where the lower and upper limits on the convolution sum reflect the causality and finiteduration characteristics of the filter.Clearly, (1) and ( 2) are identical in form and hence it The filter can also be characterized by its system function: (3) The roots of this polynomial constitute the zeros of the filter.
An FIR filter is linear-phase if (and only if) its coefficients are symmetrical around the center coefficient (10) .And its unit sample response satisfies the condition: ) when the symmetry condition is incorporated into, we have: can be expressed as: Where Hr(ω) is a real function of ω and can be expressed as: The phase characteristic of the filter for both M odd and M even is: For a symmetric h(n), the number of filter coefficients that specify the frequency response is (M + 1)/2 when M is odd or M/2 when M is even.
Linear phase FIR filters have several advantages, design problem contains only real arithmetic and not complex arithmetic, linear phase filters provide no delay distortion and only a fixed amount of delay, and the filter of length M, the number of operations are of the order of M/2 (8) .
In summary, the problem of FIR filter design is simply to determine the M coefficients h (n), n = 0, 1, 2, …, M-1, from a specification of the desired frequency response Hd(w) of the FIR filter (20) .Figure (1) represent a direct form structure implementation of an FIR filter with symmetric coefficients (21) .

4-STANDARD PSO ALGORITHM
PSO simulates the behaviors of bird flocking and used it to solve the optimization problems.PSO is initialized with a group of random particles (solutions, Xi) and then searches for optima by updating generations.In every generation, each particle is updated by following two "best" values.The first one is the best solution (fitness) it has achieved.This value is called pbest(pi).Another "best" value that is tracked by the particle swarm optimizer is the best value, obtained so far by any particle in the population.This best value is a global best and called gbest(pg).The velocity and positions of each particle is updated according to their best encountered position and the best position encountered by any particle according to the following equation (22) .
Where Vid is the particle velocity in d-dimension, Xid is the current particle position (solution) in d-dimension, w is the inertia weight.pi and pg are defined as stated before, rand is a random function in the range [0,1].c1 and c2 are the cognitive and social learning factors (22) .The process for implementing the global PSO is shown in Figure (2) (23) .

5-GENETIC ALGORITHM
Genetic Algorithm (GA) is based on the concept of "survival of the fittest".Genetic algorithms are optimization methods that resemble the natural selection.A set of numbers which can be a solution to the problem at hand is called genome (chromosome).A set of genomes is called population.The GA creates new generations by applying some genetic operators to the individuals of a population (19) .A typical GA cycle is shown in Figure (3) (2) : The encoding of the genome and defining an evaluation function are the most important parts of GA design process.The structure of the genome must represent a solution to the problem.Evaluation function on the other hand, compares genomes to a goal and assigns a score to them.GA uses scores to rank the genomes in population (19) .

6-DESIGN METHOD OF LOW PASS FIR FILTER USING PSO
Consider a linear phase FIR filter, to find an N tap FIR filter that will approximate the frequency response of the ideal Low Pass filter as shown in Figure (4).
The transfer function of an FIR filter of order N is: The corresponding frequency response is given by: In the case of linear phase, the transfer function will have symmetric coefficients that is h(n) = h(-n) and: where Now to sample the frequency in [0, pi] with L points, For example in the case of  = 0.3 , Hd(ω) equal to [ 1 1 1 0 0 0 0 0 0 0 0] when 10 samples between 0 and pi are tacked.

𝐻(𝜔) = [ 𝐻(𝜔₁), 𝐻(𝜔₂), … … , 𝐻(𝜔𝐿)]ᵀ (17)
The error function (ℇ) now can be defined as: And the fitness function that has been used is the inverse of the sum of the absolute value of the error function Ԑ (H): Where the matrix of the filter coefficients is: Now the Particle swarm optimization (PSO) algorithm used to find the impulse response, and the matrix that will be input to the PSO will be as follow: where

7-RESULTS AND COMPARISION
The proposed algorithm of Particle Swarm Optimization (PSO) was applied to the design of a 21 tap symmetric linear phase low pass FIR filter with a 0.3π cutoff frequency.
The control parameters of the PSO used in this work are as the following:- Generation Number: 300.
Different parameters of the PSO algorithm have been applied to show the effect of changing these parameters on the learning rate.Figure (5) shows the relation between the inertial weight (w) and the fitness function value.Figure (6) shows the relation between the (cognitive (c1) & social (c2)) learning parameters and the fitness function value.It can be seen that the range [0.5 to 0, 9] is a good area to choose w and it can be seen that the range [0.1 to 1.2] is a good area to choose the value of c1 and c2 for the linear phase FIR filter design problem.The PSO with w, c1 and c2 in these ranges will have less chance to fail to find the global optimum FIR filter coefficients within a reasonable number of iterations.The best optimized coefficients for the designed FIR low-pass filter with the order of 20 have been calculated by GA and PSO algorithms are given in Table (1).
Figure (12) shows the comparison of convergence behavior of FIR low pass filter designed by PSO and GA with 300 trial runs.It can be seen the convergence speed of PSO is significantly improved under the same iterations.

8-CONCLUSIONS
Particle swam optimization (PSO) is a new heuristic optimization method based on swarm intelligence.Compared with the other algorithms, the method is very simple, easily completed and it needs fewer parameters, which made it fully developed.In this paper, a particle swarm optimization algorithm (PSO) is applied to the solution of the constrained, multi-modal FIR low pass filter design problem with optimal filter coefficients.Comparison of the results of GA and PSO algorithm has been made.Simulation results justify that the proposed algorithm PSO outperform conventional GA in the accuracy of the magnitude response of the filter as well as in the convergence speed.Thus, the PSO may be used as a good optimizer for obtaining the optimal filter coefficients in any practical digital filter design problem of digital signal processing systems.
Also in this paper, simulations have been performed to illustrate the impact of changing the particle swarm optimization parameters such as the inertia weight (w), cognitive (c1) and social (c2) on the FIR digital filter design problem using PSO.It is concluded that the PSO with the inertia weight (w) in the range [0.5 to 0, 9] and the (cognitive (c1) & social (c2)) in the range [0.1 to 1.2] on average will have a better performance; that is, it has a bigger chance to find the global optimum within a reasonable number of iterations.

Table (1):
Optimized coefficients of FIR low pass filter of order 20.A direct form FIR filter (21) .
Fig. (4): Frequency response of an ideal low pass filter.

Fig. ( 7 ):
Fig. (7): Convergence behaviors of PSO in the design of the 21 tap low pass FIR filter.

Fig. ( 11 )
Fig. (11): Magnitude Response comparison between the 21 tap low pass PSO-based FIR filter and the 21 tap low pass GA-based FIR filter.

Fig. ( 12 ):
Fig. (12): Convergence speed comparison between PSO and GA in the design of 21 tap low pass FIR filter.