You are on page 1of 2

FIR Filters and Convolution Example

An FIR filter has impulse response


h n = 2 n + 3 n 1 + n 2
The input to the filter, x n , is

4 n, 0 n 3
xn =
0, otherwise

Find the filter output y n

sum of products formed between h[k] Expected output range


and x[n-k] inside red box. [0+0, 3+2] = [0,5]

h[k] -2 3 1
y[n]

n=0 ... 0 0 4 3 2 1 0 0 0 ... -2

n=1 ... 0 0 4 3 2 1 0 0 0 ... -1

n=2 ... 0 0 4 3 2 1 0 0 0 ... 1

n=3 ... 0 0 4 3 2 1 0 0 0 ... 3

n=4 ... 0 0 4 3 2 1 0 0 0 ... 15

n=5 ... 0 0 4 3 2 1 0 0 0 ... 4

n=6 ... 0 0 4 3 2 1 0 0 0 0

n=7
Flipped and
n= shifted: x[n-k]
Outputs for n < 0 and
n=
n > 5 are all 0
n=

Start at >> lter([-2 3 1],1,[1 2 3 4 0 0])


n=0 ans = -2 -1 1 3 15 4

ECE 2610 Example Page1


An FIR filter has impulse response
h n = 1 1 2 2
n = 0

The input to the filter is


x n = 4 2 2
n = 0

Find the filter output y n


sum of products formed between h[k] Expected output range
and x[n-k] inside red box. [0+0, 3+2] = [0,5]

h[k] 0 0 0 0 0 0 1 1 2 2 0 0 0 0 0 0
y[n]

n=0 0 0 0 0 2 -2 4 0 0 0 0 0 0 0 0 0 4

n=1 0 0 0 0 0 2 -2 4 0 0 0 0 0 0 0 0 2

n=2 0 0 0 0 0 0 2 -2 4 0 0 0 0 0 0 0 8

n=3 0 0 0 0 0 0 0 2 -2 4 0 0 0 0 0 0 6

n=4 0 0 0 0 0 0 0 0 2 -2 4 0 0 0 0 0 0

n=5 0 0 0 0 0 0 0 0 0 2 -2 4 0 0 0 0 4

n=6 0 0 0 0 0 0 0 0 0 0 2 -2 4 0 0 0 0

n=7 0 0 0 0 0 0 0 0 0 0 0 2 -2 4 0 0 0

n=8 0 0 0 0 0 0 0 0 0 0 0 0 2 -2 4 0 0

n=9
Flipped and Outputs for n < 0 and
n =10 shifted: x[n-k] n > 5 are all 0

n = 11

n =12

n =13

MATLAB >> filter([1 1 2 2],1,[4 -2 2 0 0 0 0])


Check ans = 4 2 8 6 0 4 0
n=0 n=5

ECE 2610 Example Page2

You might also like