You are on page 1of 28

# Signal

Processing
First

## Copyright Monash University 2009

Lecture 10
FIR Filtering
Introduction

This Lecture:
Chapter 5, Sects. 5-1, 5-2 and 5-3 (partial)

Recitation: Ch. 5, Sects 5-4, 5-6, 5-7 and 5-8
CONVOLUTION

## Copyright Monash University 2009

LECTURE OBJECTIVES
INTRODUCE FILTERING IDEA
Weighted Average
Running Average

FIR

Filters

## Show how to compute the output y[n] from the

input signal, x[n]

## Copyright Monash University 2009

DIGITAL FILTERING
x(t)

A-to-D

x[n]

COMPUTER

y[n]

D-to-A

y(t)

## CONCENTRATE on the COMPUTER

PROCESSING ALGORITHMS
SOFTWARE (MATLAB)
HARDWARE: DSP chips, VLSI

## DSP: DIGITAL SIGNAL PROCESSING

Copyright Monash University 2009

## Rockland Digital Filter, 1971

For the price of a small house, you could have one of these.
Copyright Monash University 2009

## Now it takes and plays video

Copyright Monash University 2009

DISCRETE-TIME SYSTEM
x[n]

COMPUTER

y[n]

## OPERATE on x[n] to get y[n]

WANT a GENERAL CLASS of SYSTEMS
ANALYZE the SYSTEM
TOOLS: TIME-DOMAIN & FREQUENCY-DOMAIN

## D-T SYSTEM EXAMPLES

x[n]

SYSTEM

y[n]

EXAMPLES:
POINTWISE OPERATORS
SQUARING: y[n] = (x[n])2

RUNNING AVERAGE
RULE: Eg the output at time n is the average of three
consecutive input values

## Copyright Monash University 2009

DISCRETE-TIME SIGNAL
x[n] is a LIST of NUMBERS
INDEXED by n : , x[-1]=0, x[0]=2, x[1]=4,

STEM PLOT

10

## SIMPLEST FILTER -3-PT AVERAGE

ADD 3 CONSECUTIVE NUMBERS
Do this for each n

Make a TABLE

## y[n] 13 ( x[n] x[n 1] x[n 2])

n=0
n=1
Copyright Monash University 2009

3/19/2015

11

INPUT SIGNAL

## y[n] 13 ( x[n] x[n 1] x[n 2])

OUTPUT SIGNAL

3/19/2015
Copyright Monash University 2009

12

## ANOTHER 3-pt AVERAGER

Uses PAST VALUES of x[n]
IMPORTANT IF n represents REAL TIME
WHEN x[n] & y[n] ARE STREAMS

13

Causal filtering

n is
Noncausal
TIME filtering

3/19/2015

14

## GENERAL FIR FILTER

FILTER COEFFICIENTS {bk}
DEFINE THE FILTER

y[n] bk x[n k ]
k 0

For example,

bk {3, 1, 2,1}

y[n ] bk x[n k ]
k 0

## 3x[n ] x[n 1] 2 x[n 2] x[n 3]

Copyright Monash University 2009

15

## GENERAL FIR FILTER

FILTER COEFFICIENTS {bk}
M

y[n] bk x[n k ]
k 0

FILTER ORDER is M
FILTER LENGTH is L = M+1
NUMBER of FILTER COEFFS is L
Copyright Monash University 2009

16

## GENERAL FIR FILTER

SLIDE a WINDOW across x[n]
M

y[n] bk x[n k ]
k 0

x[n-M]

x[n]

17

## FILTERED STOCK SIGNAL

INPUT

OUTPUT

50-pt Averager
Copyright Monash University 2009

3/19/2015

18

## SPECIAL INPUT SIGNALS

FREQUENCY RESPONSE (LATER)
x[n] = SINUSOID
x[n] has only one NON-ZERO VALUE

1 n 0
[n ]

0 n 0

UNIT-IMPULSE

1
n
Copyright Monash University 2009

19

## SHIFTED UNIT IMPULSE [n-i]

[n-i] is NON-ZERO
Only when n-i = 0 !!!

[n 3]

n3

3/19/2015
Copyright Monash University 2009

20

## MATH FORMULA for x[n]

Use SHIFTED IMPULSES to write x[n]
x[n] 2 [n] 4 [n 1] 6 [n 2] 4 [n 3] 2 [n 4]
NOTE: {[n-k]}
for - < k < is an
orthonormal basis
for D-T signals

x[n]

x[k ] [n k ]

3/19/2015

21

## General formula for x[n]

Use SHIFTED IMPULSES to write x[n]
x[n]

## x[k ] [n k ] x[k ] [n]

NOTE:
k[n] = [n-k] for - < k <
is an orthonormal basis for
Discrete-Time signals
Copyright Monash University 2009

3/19/2015

22

1 n 0
u[n ]

0 n 0

[n]

u[n]

u[n-1]

u[n] u[n 1]
[n]

24

## 4-pt averager with [n] input

CAUSAL SYSTEM: USE PAST VALUES
y[n] 14 ( x[n] x[n 1] x[n 2] x[n 3])

## INPUT = UNIT IMPULSE SIGNAL = [n]

x[n] [n]
y[n] 14 [n] 14 [n 1] 14 [n 2] 14 [n 3]
OUTPUT is called IMPULSE RESPONSE

h[n] {, 0, 0, 14 , 14 , 14 , 14 , 0, 0, }
Copyright Monash University 2009

25

## 4-pt Avg Impulse Response

y[n] 14 ( x[n] x[n 1] x[n 2] x[n 3])
[n] READS OUT the FILTER COEFFICIENTS

h[n] {, 0, 0, 14 , 14 , 14 , 14 , 0, 0, }
h in h[n] denotes
Impulse Response

n = 1
n=0
n=1

NON-ZERO
When window
overlaps [n]

n
n=4
n=5
Copyright Monash University 2009

26

## FIR IMPULSE RESPONSE

Convolution = Filter Definition
Filter Coeffs = Impulse Response

y[n] bk x[n k ]
k 0

## y[n ] h[k ]x[n k ]

k 0

CONVOLUTION
3/19/2015

27

FILTERING EXAMPLE
Input : x[n] (1.02)n cos(2 n / 8 / 4)

7-point AVERAGER
Removes cosine

for 0 n 40

y7 [n] 17 x[n k ]
k 0

## By making its amplitude (A) smaller

3-point AVERAGER
Changes A slightly

y3[n] 13 x[n k ]
k 0

28

Phase shift

3/19/2015

29