# Digital Filter Design

Digital Filter Design Methods | Output Response—Digital Filtering of Signals |

Poles and Zeros of Digital Filters |

*Mathematica* provides a comprehensive set of methods for designing digital filters.

## Digital Filter Design Methods

LeastSquaresFilterKernel | create an FIR filter using the least-squares method |

FrequencySamplingFilterKernel | create an FIR filter using frequency sampling |

EquirippleFilterKernel | create an FIR filter using the equiripple method |

ToDiscreteTimeModel | create an IIR digital filter from an analog prototype |

Digital filter design methods.

### Least-Squares Method

This method obtains a finite impulse response (FIR) from a given prototype filter specification in the frequency domain by means of the inverse discrete-time Fourier transform.

Define a zero-phase ideal lowpass filter with a cutoff frequency of 1.2 radians per second.

In[90]:= |

Out[90]= |

Evaluating this expression for integer values of from to will return a filter of length .

In[107]:= |

Out[107]= |

In[73]:= |

Out[73]= |

The least-squares method is also known as the window-based method. The mean-squared error can be diminished by applying a smoothing window to the FIR returned by LeastSquaresFilterKernel.

In[114]:= |

Out[114]= |

In[115]:= |

Out[116]= |

Different windows return different attenuations. Select a window type by the degree of the desired attenuation.

In[130]:= |

Out[130]= |

### Frequency Sampling Method

Frequency sampling allows the creation of an FIR filter by specifying the filter's amplitude spectrum on the interval at a finite number of uniformly spaced frequency locations.

In[137]:= |

Out[137]= |

In[138]:= |

Out[138]= |

In[139]:= |

Out[140]= |

In[142]:= |

Out[142]= |

### Equiripple Method

The Parks-McClellan-Rabiner (1979) algorithm is one of the most popular methods of designing linear-phase FIR filters. It minimizes the maximum deviation from the desired ideal frequency response and results in filters with equal ripples in each of the bands of the filter.

In[207]:= |

Out[207]= |

In[208]:= |

Out[208]= |

### Create a Digital Filter from an Analog Prototype

A popular method of creating digital filters is to transform analog prototypes to their digital equivalents using the bilinear transformation. The result is an infinite impulse response (IIR) filter, represented as a TransferFunctionModel.

ToDiscreteTimeModel | discrete-time approximation of an analog filter |

Create an IIR filter from an analog prototype.

In[131]:= |

Out[131]= |

In[132]:= |

Out[132]= |

In[133]:= |

Out[133]= |

## Poles and Zeros of Digital Filters

TransferFunctionPoles | extract poles of analog filters |

TransferFunctionZeros | extract zeros of analog filters |

Poles and zeros of analog filters.

In[141]:= |

Out[142]= |

In[143]:= |

Out[143]= |

In[150]:= |

Out[150]= |

In[156]:= |

Out[156]= |

## Output Response—Digital Filtering of Signals

### FIR Filters

ListConvolve | convolve an FIR filter with data |

ImageConvolve | convolve an FIR filter with image |

DiscreteConvolve | symbolic convolution of two signals |

In[266]:= |

Out[267]= |

In[268]:= |

Out[268]= |

In[270]:= |

Out[271]= |

In[272]:= |

Out[274]= |

In[275]:= |

Out[275]= |

### IIR Filters

RecurrenceFilter | filter a signal with an IIR filter |

RecurrenceTable | response of a filter obtained by solving recurrence equations |

OutputResponse | output response of a filter |

DiscreteConvolve | symbolic convolution of two signals |

In[92]:= |

In[97]:= |

Out[98]= |

In[101]:= |

Out[101]= |

In[99]:= |

Out[99]= |

In[100]:= |

Out[100]= |

In[102]:= |

Out[104]= |

In[105]:= |

Out[105]= |