## Description

**Problem Statement**

**Problem Statement**

Designing of FIR filters are broadly done by two methods basically- windowing method and frequency sampling method. These methods are based on an approximation of ideal filter although none of them achieves that behavior up to 100% and also not possible to achieve since no single design method fulfills requirements of all type of filters like band pass, band stop, low pass, and high pass filter. This is because of different ripples in the passband and the stopband, the stop band attenuation and the transition width. Problems formulated by literature survey in filter designing are:

- There are various kinds of window functions (Butterworth, Chebshev, Kaiser, etc.). These windows limit the infinite length impulse response of ideal filter into a finite window to design an actual response. But the major drawback of windowing methods is that it does not allow sufficient control of the frequency response in the various frequency bands and other filter parameters such as transition width, and it tends to process relatively long filter lengths.
- The Window method is applicable only if the desired window response is absolutely integrable. If it is complicated or cannot easily be put into a closed-form mathematical expression, evaluation of impulse response becomes difficult.
- The frequency sampling technique is suitable for designing filters with a given magnitude response. The ideal frequency response of the filter is approximated by placing appropriate frequency samples in the z-plane and then calculating the filter coefficients using the IFFT algorithm, yet it gives errors in the frequency response at points where it is not sampled.
- Various optimization techniques are used to reduce errors in frequency sampling methods where frequency samples are chosen to satisfy optimization criteria.

**Proposed Work**

**Proposed Work**

In our work, we are designing a digital FIR filter by the frequency sampling method.

The frequency sampling method will work in the following way, we start in the frequency domain, and sample the desired frequency response H(e^{jÎ©}) with N evenly-spaced samples instead of a continuous frequency, and get Hd(k)= Hd(e^{jÎ©})|Î©=2Ï€k/N, (k=0,1,â€¦, N-1). Then, let H(k)= Hd(k)= Hd(e^{jÎ©})|Î©=2Ï€k/N, we get the unit impulse response, h(n)=IDFT[H(k)], where IDFT is Inverse Discrete Fourier Transform. The inverse DFT then yields an impulse response which will lead to a filter whose frequency response the same as that of the specification exactly at the location of the frequency samples.

Here optimization of filter coefficients is used to design the low pass filter. Bio-inspired optimization serves our purpose. Bacterial foraging optimization has been used earlier but backed by drawbacks of slow convergence. So the improvement in BFO is brought by the addition of particle swarm optimization (PSO).

**How optimization decides the filter coefficients**

**How optimization decides the filter coefficients**

This BPSO optimization calls an objective function each time. This objective function is the backbone of the whole algorithm. It calculates the error between designed filters frequency response and ideal filter response and optimization tends to minimize that error. Many constraints are put in an objective function to reach the destination. The number of variables to optimize by BPSO is the order of filter divided by 2 if it is even else ordered +1 divided by 2. This is because digital filter coefficients exhibit a property of similarity. As per the property of BFO and PSO, initial positions of bacteria are random, but we have to fix some of them to give the control of defined passband frequency.

All frequencies whether it is passband or stop band is considered in normalized form as the property of frequency sampling designing states. The evenly spaced samples are compared with passband frequency and where it is found less than later, the bacteria position of that index is replaced by 1 and rest are random bacteria positions. This process provides better controlling over passband frequency response. The error fitness function calculated in every iteration is used to update the new positions of bacteria or in other words, update the value of the coefficient to minimize the error.

**Objective Function**

**Objective Function**

The final particle position obtained after reaching the maximum number of iterations or condition designed to check error reduction after iteration is considered as the final filter coefficients for which unit impulse response is calculated further. The condition to check the reduction of error after iterations are different for BFO and PSO. Various filter parameters which are responsible for the optimal filter design are the stopband and passband normalized frequencies the pass band and stop band ripples, the stopband attenuation, and the transition width. These parameters are mainly decided by the filter coefficients. Different kind of error fitness function calculation is used in the literature but in our work following error calculation is used:

To give control of user over passband and stopband ripples the error function is updated as:

This equation provides the constraint to the objective function for minimization of error. This error is compared to previous error after every iteration and if the condition is met then optimization stops. The code for this objective function and optimization is solely developed by team at https://free-thesis.com.

More information about the algorithm and results can be checked in report.

## Reviews

There are no reviews yet.