Keywords

1 Introduction

In digital signal processing (DSP), filters have a significant role so that useful information can be processed. Digital filters are used for different applications in domains like signal processing, communication systems, channel equalization and noise reduction [1]. Digital filters are most used in signal separation and restoration. When noise or external signal is added to the information, then separation is needed and restoration is required when the receiving or transmitting signal gets deformed. Besides, these digital filters have a wide range of applications in image processing [2,3,4], system modelling [5,6,7,8,9], speech processing [10] and audio processing [11].

Digital filters are classified as finite impulse response (FIR) and infinite impulse response (IIR) filters. The present output of the FIR filters depend upon the present input samples only. FIR filters are designed recursively and have the characteristic of linear phase and stability, whereas the present output of IIR filters depend upon the present and past input and past output also. They have non-recursive nature and require fewer coefficients and less storage in comparison with FIR filters. Easy implementation, high stability and linear phase are the main attributes of FIR filters. In literature, FIR filters are designed using conventional methods such as windowing method and frequency sampling method. But due to lack of the control on cut-off frequency and transition width these conventional methods fails. This motivated the researchers to use the swarm-based optimization algorithms.

In this paper, a newly proposed optimization algorithm called grasshopper optimization algorithm (GOA) [12] is used for the design of FIR low-pass filter (LPF) and high-pass filter (HPF). The results obtained using GOA are compared with other two existing algorithms, particle swarm optimization (PSO) [13] and grey wolf optimization (GWO) [14] algorithms.

The exclusive features of  GOA are as follows:

  1. 1.

    The GOA does not get trapped in local minima, and it does not concentrate towards the target too hastily as for exploration and exploitation, Different weights are used.

  2. 2.

    Unlike other algorithms, in GOA, updating of position of search agents depends on all the search agent positions. This makes GOA different from other algorithms.

  3. 3.

    It has less elapsed time and fast convergence.

The whole paper is organised as: Sect. 2 describes the problem formulation, Sect. 3 briefly explain the applied GOA. Section 4 discusses the results and analysis and Sect. 5 concludes the work done.

2 Problem Formulation

The system transfer function of FIR filter is given by

$$D(z) = \sum\limits_{k = 0}^{K - 1} {} d(k)z^{-k}$$
(1)

where d(k) denotes the filter coefficients and K represents the length while K − 1 is order of the filter. Our purpose is to evaluate the optimal value of filter coefficients, using PSO, GWO and GOA, in such a manner that the designed filter response converges towards ideal filter response. Stop band ripples, lower pass band ripples, reduced transition bandwidth and higher stop band attenuation are some of the desiderate attributes of the filter. The filter coefficients d(k) represent dimension of search agents in evolutionary algorithms under consideration while the position of search agents is updated until maximum iteration is met or minimum value is achieved by error fitness function.

The magnitude response of digital FIR filter can be written as:

$$D(\omega ) = \sum\limits_{k = 0}^{K - 1} {} d(k){\text{e}}^{ - j\omega k}$$
(2)

ω is the digital frequency between −π to π in rad/s.

The fitness function plays an important role in process of designing a FIR filter. Different fitness functions might give different results for same problem. The fitness function defines the relative importance of a design. A higher fitness value implies a better design. The fitness function may be defined in several different ways. Therefore, appropriate choice of error objective function is crucial to get the bona fide output. Mean square error (MSE) is taken as error objective function given in Eq. 3. The minimization of MSE between the ideal and evaluated response of the filter in terms of magnitude is the primary objective of this paper.

$$E(\omega ) = \frac{1}{\omega }\sum\nolimits_{\forall \omega } {\left( {\left| {D_{id}(\omega )} \right| - \left| {D(\omega )} \right|} \right)}^{2}$$
(3)

3 Grasshopper Optimization Algorithm

Grasshoppers creates one of the largest group found in nature for food-seeking, even though they are individual in nature. Nymph and adulthood exhibit this swarming behaviour. Gravity force on the grasshopper, social interaction between grasshoppers and direction of the wind are the factors which affect process of seeking food. The strength of attractive forces and repulsive forces between grasshoppers constitute social interaction. Since nymph do not have wings, therefore, their movement is also affected by direction of wind. It is assumed that direction of wind is in the direction of target. Force of gravity is not taken into consideration while evaluating next position of agent. Next position which is denoted by Xt+1 of a search agent can be evaluated using following equation

$$X_i^d = c\left( {\sum_{j = 1}^N {c\frac{{ub_d - lb_d }}{2}} ~s~\left( {~\left| {x_d^j - x_i^d } \right|} \right)\frac{{x_j - x_d }}{{d_{ij} }}} \right) + T_d$$
(4)

First c behaves as the inertia weight in order to support exploration while another c represents the diminishing factor which shrinks all the comfort zones to achieve the best exploitation. S represents the social interaction force on grasshopper while target position is denoted by Td.

$$c = C_{{{\text{max}}}} - l\frac{{C_{{{\text{max}}}} - C_{{{\text{min}}}} }}{L}$$
(5)

The value of c gets updated in compliance with Eq. 5, which varies on the value of iteration l that changes from one to maximum iteration L (maximum iteration) (Fig. 1).

Fig. 1
figure 1

Flowchart of  GOA

Algorithm of Grasshopper Optimization

  1. 1.

    Initialize swarm N, Cmax, Cmin and highest iterations L

  2. 2.

    Initialize ωn, k, ωl, ωu

  3. 3.

    T = Target search agent (best)

  4. 4.

    While (l < L)

    1. a.

      Update c as given in equation

  5. 5.

    For each search agent

    1. a.

      Evaluate error fitness value using Eq. (3)

    2. b.

      Get T (best search agent)

    3. c.

      Current position of agent is updated using Eq. (4)

    4. d.

      Check if search agent is overflowing boundaries, if yes, relocate it

  6. 6.

    End for

  7. 7.

    If there is a better solution, Update T

  8. 8.

    l = l + 1

  9. 9.

    End while

  10. 10.

    Return T

4 Result Analysis

The results of FIR 30th order low-pass and high-pass filter designed using PSO, GWO and GOA are evaluated. A total of 31 optimal filter parameters and MSE are calculated of all the three algorithms. MATLAB version R2007b software is used for attaining the results on computer having i5 10th Generation, 3.20 GHz and 8 GB RAM.

4.1 Low Pass Filter

GOA, PSO and GWO are used to build the 30th order  LPF having cut-off frequency 0.5π. To verify the performance of applied GOA optimal parameters, minimum MSE and magnitude profile are taken as performance measures. A total of 31 optimal filter parameters are calculated of GWO, PSO and GOA. These calculated coefficients are listed in Table 1. Statistical results of MSE are obtained and described in Table 2. Based on the evaluated results, it can be stated that GOA is the right choice for FIR filter design problem.

Table 1 Optimal values of coefficient for low-pass filter
Table 2 Statistical results of MSE for 30th order low-pass filter

Figure 2 represents the graphical representation of the normalized magnitude response of low-pass filter of the algorithms GOA, PSO and GWO. Table 2 clearly specifies that the GOA is best among the three as it has the lowest value of the statistical results obtained as the best value obtained for GOA is 0.00000529 with standard deviation of 0.00008083.

Fig. 2
figure 2

Magnitude response of 30th order FIR LPF

4.2 High Pass Filter

GOA, GWO and PSO are used to build 30th order high-pass filter having cut-off frequency 0.5π. The performance analysis of applied GOA in terms of optimal parameters, minimum MSE and magnitude profile is done. A total of 31 optimal filter parameters of PSO, GWO and GOA are calculated. These calculated coefficients are listed in Table 3. Statistical results of MSE in terms of best, worst and mean values are obtained and are described in Table 4. Based on the evaluated results, it can be observed that GOA is best suited for FIR filter design problem.

Table 3 Optimal values of coefficient for high-pass filter
Table 4 Statistical results of MSE for 30th order high-pass filter
Fig. 3
figure 3

Magnitude response of 30th order FIR HPF

Figure 3 represents the graphical representation of the normalized magnitude response of high-pass filter of the algorithms GOA, PSO and GWO. Table 4 clearly specifies that the GOA is best among the three to as it has the lowest value of the statistical results obtained as the best value for GOA obtained is 0.00007381 with standard deviation of 0.00006853.

5 Conclusion

This work considers the design of FIR LPF and  HPF, 30th order using PSO, GWO and GOA and set side by side the performance between the three in terms of their proficiency to advance towards the ideal filter response. Filter coefficients for LPF and HPF have been attained by minimizing the error function. GOA-based FIR filter was found to provide the best solution in comparison between the other two algorithms and provides least pass band ripple, stop band ripple and greater attenuation stop band.