Digital Filter Design
Digital Filter Design Methods | Output Response—Digital Filtering of Signals |
Poles and Zeros of Digital Filters |
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 |
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.
The impulse response is obtained by taking the inverse discrete-time Fourier transform of the filter specification:
In[1]:=1

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-4t8mky
Out[1]=1

In[2]:=2

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-8bxqkz
Out[2]=2

This method minimizes the mean-squared error between the ideal specification and the resulting FIR filter:
In[3]:=3

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-22g3aj
Out[3]=3

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[4]:=4

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-0wjrma
Out[4]=4

In[5]:=5

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-yrsp4m
Out[6]=6

Different windows return different attenuations. Select a window type by the degree of the desired attenuation.
In[6]:=6

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-48z5y7
Out[6]=6

Frequency Sampling Method
Frequency sampling allows the creation of an FIR filter by specifying the filter's amplitude spectrum on the interval 0≤ ω≤ π at a finite number of uniformly spaced frequency locations.
In[7]:=7

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-qx1i21
Out[7]=7

In[8]:=8

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-smnc2x
Out[8]=8

In[9]:=9

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-5mjg57
Out[10]=10

In[11]:=11

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-pnmqw2
Out[11]=11

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[12]:=12

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-348hxd
Out[12]=12

In[13]:=13

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-foxntk
Out[13]=13

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 |
In[14]:=14

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-myi9yv
Out[14]=14

In[15]:=15

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-yrb4p3
Out[15]=15

In[16]:=16

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-1ut3li
Out[16]=16

TransferFunctionPoles | extract poles of analog filters |
TransferFunctionZeros | extract zeros of analog filters |
In[17]:=17

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-dvxna1
Out[18]=18

In[19]:=19

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-5jv6ok
Out[19]=19

In[20]:=20

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-n5f1n9
Out[20]=20

In[21]:=21

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-21kbba
Out[21]=21

FIR Filters
ListConvolve | convolve an FIR filter with data |
ImageConvolve | convolve an FIR filter with image |
DiscreteConvolve | symbolic convolution of two signals |
In[67]:=67

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-x4gkmi
Out[68]=68

In[65]:=65

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-c2c2wb
Out[65]=65

In[69]:=69

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-g1ghga
Out[69]=69

In[28]:=28

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-soy8y4
Out[30]=30

In[31]:=31

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-4ihaml
Out[31]=31

IIR Filters
RecurrenceFilter | apply an IIR filter to a signal |
RecurrenceTable | iteratively solve the recurrence equation |
OutputResponse | output response of a filter |
In[32]:=32

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-rld01i
In[33]:=33

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-6xostg
Out[34]=34

In[35]:=35

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-hfwwnz
Out[35]=35

Compute the impulse response using OutputResponse:
In[36]:=36

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-eair8b
Out[36]=36

Compute the impulse response by solving the corresponding recurrence equation model of the filter using RecurrenceTable:
In[37]:=37

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-5lpx81
Out[37]=37

In[38]:=38

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-sl5bi
Out[40]=40

In[41]:=41

✖
https://wolfram.com/xid/06eqt1wysv9dr98be-md9z15
Out[41]=41
