Journal of Computer and Communications
Vol.06 No.11(2018), Article ID:89066,6 pages
10.4236/jcc.2018.611029

General FIR Filter Design with Linear Phase in Passband by Water Cycle Algorithm

Haijiang Hu, Shaojing Song, Yumei Gong

College of Engineering, Shanghai Polytechnic University, Shanghai, China

Received: October 31, 2018; Accepted: November 23, 2018; Published: November 30, 2018

ABSTRACT

FIR filter is an important type of filter in the field of signal processing because of its inherent stability, simpler structure, and easier implementation on linear phase. WCA is used to solve FIR filter design with low magnitude error and linear phase in passband. This method uses WCA to optimize the filter coefficient based on the low magnitude errors in all frequency domains. Moreover, in the constraint conditions, the least group delay in passband is used for the optimization. The experiments testify this method has good performance on the passband error and group delay error in the passband. Therefore this method is an efficient algorithm for FIR filter optimization which can be used in the digital signal processing widely.

Keywords:

FIR, WCA, Linear Phase, Optimization

1. Introduction

FIR filter is an important type of filter in the field of signal processing because of its inherent stability, simpler structure, and easier implementation on linear phase [1]. The linear phase is an important property of filters in many applications. If the coefficients of a FIR filter are odd symmetry or even symmetry, this FIR filter has the linear phase. The linear phase in entire frequency domain can be easily achieved using the classic design method for FIR filters. However, the symmetric coefficients are not realized by all FIR design methods, especially in the methods based on the optimizing theories. Some optimization methods can obtain very good amplification-frequency characteristic, but not realize the linear phase. Therefore how to design an asymmetric coefficient FIR filter with excellent amplification-frequency characteristic and linear phase is an interesting study [2] [3] [4] [5] [6].

Water cycle algorithm (WCA) [7] is a metaheuristic optimizer which is to solve the constrained engineering optimization problems. This algorithm simulates the process of water cycle in nature. The fundamental concept of the WCA is inspired by the observation of water cycle process, and movement of rivers and streams to the sea in the real world. In this paper we focus on FIR design with the asymmetric coefficients and the linear phase in the passband. WCA is applied in phase optimization in the process of our FIR design.

2. Principle of WCA

The same to other bionic algorithm, the idea of WCA is also inspired from nature. In our world, a river or stream is collected when water moves downhill. This means that most rivers are formed high up in the mountains, where the snow or the glaciers melt. The rivers always flow downhill. On their downhill journey and eventually ending up to a sea, water is collected from rain and other streams. Therefore, streams flow to the rivers and rivers flow to the sea.

WCA begins with an initial population which is called raindrops. So at first we have rain. The best raindrop is chosen as a sea while some good raindrops are selected as the river. Besides the sea and the river, other unselected raindrops are defined as the stream which flow to the river and the sea. For the N v a r dimensional optimization problem, a raindrop is defined as an array of 1 × N v a r , which is described as follows:

Raindrop = [ x 1 , x 2 , x 3 , , x N ] .

At the beginning of WCA, a population of raindrops is generated by use of a matrix X with size N p o p × N v a r which is shown as follows:

PopulationofRaindrops = [ R a i n d r o p 1 R a i n d r o p 2 R a i n d r o p 3 R a i n d r o p N p o p ] = [ x 1 1 x 2 1 x 3 1 x N v a r 1 x 1 2 x 2 2 x 3 2 x N v a r 2 x 1 N p o p x 2 N p o p x 3 N p o p x N v a r N p o p ] . (1)

In WCA, the cost of a raindrop is calculated by a cost function which is shown as follows:

C i = C o s t i = f ( x 1 i , x 2 i , x 3 i , , x N v a r i ) , i = 1 , 2 , 3 , , N p o p , (2)

where N p o p and N v a r are the number of raindrops (initial population) and the number of design variables, respectively. Then N p o p raindrops is created and initialized, and the N s r raindrops of them which are the best individuals or minimum values are chosen as sea and rivers. Especially, a raindrop with minimum value among others is defined as sea. Therefore, N s r is sum of sea and rivers which is shown as follows:

N s r = n u m b e r o f r i v e r s + 1. (3)

The number of other unselected raindrops is

N r a i n d r o p s = N p o p N s r . (4)

WCA uses an equation to assign the raindrops to rivers and sea based on the flow intensity. This equation is

N S n = r o u n d { | C o s t n i = 1 N s r C o s t i | × N r a i n d r o p s } , n = 1 , 2 , 3 , , N s r , (5)

where N S n is the number of streams which flow to the particular rivers or sea.

In WCA, all streams and rivers flow to sea. Obviously sea is the best optimal point. A stream flows to the river along the connecting line between them using a randomly selected distance that is shown as follows:

X ( 0 , C × d ) , C > 1 , (6)

where C is a value between 1 and 2 and near 2 (best value is 2), d is the current distance between stream and river, respectively. X is a random number between 0 and C × d . C enables streams to flow in different directions towards the rivers. Similarly, C also can be used for the water flow from river to sea. So, the new position for streams and rivers are shown as follows:

X s t r e a m i + 1 = X s t r e a m i + r a n d × C × ( X r i v e r i X s t r e a m i ) , (7a)

X s t r e a m i + 1 = X s t r e a m i + r a n d × C × ( X s e a i X s t r e a m i ) , (7b)

X r i v e r i + 1 = X r i v e r i + r a n d × C × ( X s e a i X r i v e r i ) , (8)

where rand is random number between 0 and 1. If the solution from a stream is better than its connecting river, the positions of stream and river are exchanged each other. Similarly, if the solution from a river is better than sea, the positions of river and sea are exchanged each other. Therefore, a river should be considered as a locally optimal solution, while sea should be considered as the globally optimal solution.

Evaporation is a method to prevent the algorithm from rapid convergence (immature convergence). In WCA, the evaporation process causes the sea water to evaporate as rivers/streams flow to the sea. This method is proposed in order to avoid getting trapped in local optima. The following pseudo code shows how to determine whether or not river flows to the sea.

If

| X s e a i X r i v e r i | < d max , i = 1 , 2 , 3 , , N s r 1

Evaporation and raining process

End

Where d max is a small value which is close to zero. Therefore, if the distance between a river and sea is less than d max , it means that the river has reached or joined the sea. In this situation, the evaporation process is used and as seen in the nature after some adequate evaporation the raining will start. A large value for d max reduces the search while a small value encourages the search intensity near the sea. Therefore, d max controls the search intensity near the sea (the optimum solution). In original WCA, the value of d max can be decreased adaptively as:

d max i + 1 = d max i d max i max i t e r a t i o n . (9)

After satisfying the evaporation process, the raining process is applied. In the raining process, the new raindrops form streams in the different locations (acting similar to mutation operator in GA). For specifying the new locations of the newly formed streams, the following equation is used:

X s t r e a m n e w = L B + r a n d × ( U B L B ) , (10)

where LB and UB are lower and upper bounds defined by the given problem, respectively. The rest of new raindrops are assumed to form new streams which flow to the rivers or may directly flow to the sea.

3. Prepare Your Paper before Styling

3.1. Example 1

We use WCA to implement a general FIR with passband linear group delay design. For lowpass filter example: Filter order = 24, w p = 0.3 π , w s = 0.4 π , passband group delay = 10.

In this design, we use the smallest group delay in passband as object function, amplitude error in passband and stopband as constraint condition. Therefore a general FIR design can be described as follows:

min f ( X ) = H p b 1 2 + H s b 2 ,

s .t . G r o u p D e l a y p b ( X ) G d i d e a l 2 < τ p b ,

where τ p b is the presetting values. In our design, the population is 100, the number of sea and rivers is 8, and the iteration is 2000, respectively.

Our all filter designs are realized in Matlab R2009b. WCA function is obtained from [8]. Figure 1 shows the performance of design result by our proposed method. From Figure 1, we can know the magnitude-frequency characteristicmeets the requirement while the group delay in passband is the approximate linearization.

3.2. Example 2

In this example, we also use single-object WCA to implement a general FIR design. For bandpass filter example: Filter order = 24, w s 1 = 0.25 π , w p 1 = 0.35 π , w p 2 = 0.6 π , w s 2 = 0.7 π , passband group delay = 14. From Figure 2, we also we can know the magnitude-frequency characteristic meets the requirement while the group delay in passband is the approximate linearization.

Figure 1. Performance of design result for example 1.

Figure 2. Performance of design result for example 2.

4. Conclusion

In this paper we use WCA to solve FIR filter design with low magnitude error and linear phase in passband. This method uses WCA to optimize the filter coefficient based on the low magnitude errors in all frequency domains. Moreover, in the constraint conditions, the least group delay in passband is used for the optimization. The experiments testify this method has good performance on the passband error and group delay error in the passband. Therefore this method is an efficient algorithm for FIR filter optimization which can be used in the digital signal processing widely.

Acknowledgements

The generous support of the Discipline Construction Fund of SSPU (XXKZD1605) and the Construction of University Enterprise Cooperation Automobile Electronic Joint Experiment Center (A11NH182016) are gratefully acknowledged.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

Cite this paper

Hu, H.J., Song, S.J. and Gong, Y.M. (2018) General FIR Filter Design with Linear Phase in Passband by Water Cycle Algorithm. Journal of Computer and Communications, 6, 326-331. https://doi.org/10.4236/jcc.2018.611029

References

  1. 1. Beylkin, G., Lewis, R.D. and Monzón, L. (2012) On the Design of Highly Accurate and Efficient IIR and FIR Filters. IEEE Transactions on Signal Processing, 60, 4045-4054. https://doi.org/10.1109/TSP.2012.2197397

  2. 2. Longpiur, R.C., Shpak, D.J. and Antoniou, A. (2013) Improved Design Method for Nearly Linear-Phase IIR Filters Using Constrained Optimization. IEEE Transactions on Signal Processing, 61, 895-906. https://doi.org/10.1109/TSP.2012.2231678

  3. 3. Wu, C., Gao, D. and Teo, K.L. (2013) A Direct Optimization Method for Low Group Delay FIR Filter Design. Signal Process, 93, 1764-1772. https://doi.org/10.1016/j.sigpro.2013.01.015

  4. 4. Lai, X., Lai, C. and Zhao, R. (2011) An Iterative Approach to Near-Uniform Group- Delay Error Design of FIR Filters. IEEE Signal Process. Lett., 18, 107-110. https://doi.org/10.1109/LSP.2010.2099217

  5. 5. Chui, K.M., Chan, S.C. and Yeung, K.S. (2005) Design of FIR Digital Filters with Prescribed Flatness and Peak Error Constraints Using Second-Order Cone Programming. IEEE Trans. Circuits Syst. II, 52, 601-605. https://doi.org/10.1109/TCSII.2005.850515

  6. 6. Lai, X. (2009) Optimal Design of Nonlinear-Phase FIR Filters with Prescribed Phase Error. IEEE Trans. Signal Process., 57, 3399-3410. https://doi.org/10.1109/TSP.2009.2021639

  7. 7. Eskandar, H., Sadollah, A., Bahreininejad, A., et al. (2012) Water Cycle Algorithm— A Novel Metaheuristic Optimization Method for Solving Constrained Engineering Optimization Problems. Computers & Structures, 110, 151-166. https://doi.org/10.1109/TSP.2009.2021639

  8. 8. http://yarpiz.com