# Interpolating FIR filters

## Example

Assume we start with the sample $\ [1 \ 2 \ 3 \ 4 \ 3 \ 2 \ 1]$. Padding with zeros gives: $\ [1 \ 0 \ 2 \ 0 \ 3 \ 0 \ 4 \ 0 \ 5 \ 0 \ 3 \ 0 \ 2 \ 0 \ 1]$. Let's apply 2 filters.

Filter 1: $\ [1 \ 1]$ (also written as $\ y(kT)=1.0 \cdot x(kT) + 1.0 \cdot x(k-1)T$).

This filter gives: $\ [1 \ 1 \ 2 \ 2 \ 3 \ 3 \ 4 \ 4 \ 5 \ 5 \ 4 \ 4 \ 3 \ 3 \ 2 \ 2 \ 1 \ 1]$. This is a hold function.

Filter 2: $\ [0.5 \ 1 \ 0.5]$ (also written as $\ y(kT)=0.5 \cdot x(kT) + 1.0 \cdot x(k-1)T + 0.5 \cdot x(k-2)T$

This filter gives: $\ [.5 \ 1.0 \ 1.5 \ 2.0 \ 2.5 \ 3.0 \ 3.5 \ 4.0 \ 4.5 \ 5.0 \ 4.5 \ 4.0 \ 3.5 \ 3.0 \ 2.5 \ 2.0 \ 1.5 \ 1.0 \ 0.5]$. This is a linear interpolater.

I had a lot of trouble finding generic information about the number of multiply/add operations used in an interpolation FIR filter. I did find formula for the number of multiply/add operation used by the MATLAB function upfirdn, which upsamples, applies an FIR filter, and then downsamples. It is: $\ (L_h L_x-pL_x)/q$ where $\ L_h$ and $\ L_x$ are the lengths of $\ h[n]$(the impulse response of the FIR filter) and $\ x[n]$(the original signal), respectively.