## Multirate Filter Bank Implementation

The `upfirdn` function alters the sampling rate of a signal by an integer ratio P/Q. It computes the result of a cascade of three systems that performs the following tasks:

• Upsampling (zero insertion) by integer factor `p`

• Filtering by FIR filter `h`

• Downsampling by integer factor `q` For example, to change the sample rate of a signal from 44.1 kHz to 48 kHz, we first find the smallest integer conversion ratio `p/q`. Set

```d = gcd(48000,44100); p = 48000/d; q = 44100/d; ```

In this example, `p` = `160` and` q` = `147`. Sample rate conversion is then accomplished by typing

```y = upfirdn(x,h,p,q) ```

This cascade of operations is implemented in an efficient manner using polyphase filtering techniques, and it is a central concept of multirate filtering. Note that the quality of the resampling result relies on the quality of the FIR filter `h`.

Filter banks may be implemented using `upfirdn` by allowing the filter `h` to be a matrix, with one FIR filter per column. A signal vector is passed independently through each FIR filter, resulting in a matrix of output signals.

Other functions that perform multirate filtering (with fixed filter) include `resample`, `interp`, and `decimate`.