0% found this document useful (0 votes)
179 views32 pages

Ece2610 Chap6

This chapter discusses the frequency response of FIR filters. The key points are: 1) The frequency response relates how an FIR filter responds to complex sinusoidal inputs and is defined as the Fourier transform of the impulse response. 2) For a complex sinusoidal input, the output is another complex sinusoid whose amplitude and phase are determined by the frequency response at the input frequency. 3) For real inputs that are sums of sinusoids, the output is a sum of sinusoids where each component picks up the magnitude and phase of the frequency response at its corresponding frequency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views32 pages

Ece2610 Chap6

This chapter discusses the frequency response of FIR filters. The key points are: 1) The frequency response relates how an FIR filter responds to complex sinusoidal inputs and is defined as the Fourier transform of the impulse response. 2) For a complex sinusoidal input, the output is another complex sinusoid whose amplitude and phase are determined by the frequency response at the input frequency. 3) For real inputs that are sums of sinusoids, the output is a sum of sinusoids where each component picks up the magnitude and phase of the frequency response at its corresponding frequency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Frequency Response

of FIR Filters

Chapter

This chapter continues the study of FIR filters from Chapter 5,


but the emphasis is frequency response, which relates to how the
filter responds to an input of the form
x n = e

0n
j

n .

A fundamental result we shall soon see, is that the frequency


response and impulse response are related through an operation
known as the Fourier transform. The Fourier transform itself is
not however formally studied in this chapter.

Sinusoidal Response of FIR Systems


Consider an FIR filter when the input is a complex sinusoid
of the form
0n
j j

x n = Ae e

n ,

(6.1)

where it could be that x n was obtained by sampling the


j j t
0 = 0 Ts
complex sinusoid x t = Ae e 0 and
From the difference equation for an M + 1 tap FIR filter,
y n =

bk x n k

k=0

ECE 2610 Signal and Systems

bk Ae

0 n k
j j

(6.2)

k=0

61

Sinusoidal Response of FIR Systems

0n M
j j

y n = Ae e

0n
j j

= Ae e

bk e

k = 0
He

0
j

0 k
j

(6.3)

where we have defined for arbitrary


M

He =

bk e

k
j

(6.4)

k=0

to be the frequency response of the FIR filter


j
, to
Note: The notation H e is used rather than say H
be consistent with the z-transform which will defined in
Chapter 7, and to emphasize the fact that the frequency
response is periodic, with period 2 (more on this later)

+ j sin
, where sine and cosine are
Note: e j = cos

both mod 2 functions


Returning to (6.2), the implication is that when the input is a
0 , the output is also a
complex exponential at frequency
0
complex exponential at frequency
The complex amplitude (magnitude and phase) of the input is
changed as a result of passing through the system
0 multiplies the input ampli The frequency response at
tude to produce the output
It is not true in general that y n = H e j 0x n , but
only for the special case of x n a complex sinusoid
applied starting at

ECE 2610 Signals and Systems

62

Sinusoidal Response of FIR Systems

that is
The frequency response is a complex function of
generally viewed in either polar or rectangular form

He = He e

j H e

(6.5)

= Re H e + jIm H e

The polar or magnitude and phase form is perhaps the


most common
The polar form offers the following interpretation of y n in
terms of x n , when the input is a complex sinusoid

yn = He e

j H e

= H e Ae

n
j j

Ae e

(6.6)

n
j H e + j

Here we see that the input amplitude is multiplied by the


frequency response amplitude, and the input phase has
added to it the frequency response phase
The output amplitude expression means that H e j is
also termed the gain of an LTI system

Example: b k = 1 1 3 1 1
The frequency response of this FIR filter is

He =

bk e

k
j

k=0

= 1+e

ECE 2610 Signals and Systems

+ 3e

j 2

+e

j 3

+e

j 4

63

Sinusoidal Response of FIR Systems

He = e
= e

j2

j2

j2

+ 2 cos
+ 3
2 cos 2

+e

+3+e

+e

j2

We have used the inverse Euler formula for cosine twice


For this particular filter we have that

j
+ 2 cos 2

H e = 3 + 2 cos

H e = 2

Why?

Use MATLAB to plot the magnitude and phase response


>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

w = 0:2*pi/200:2*pi;
H = exp(-j*2*w).*(3 + 2*cos(w) + 2*cos(2*w));
subplot(211)
plot(w,abs(H))
axis([0 2*pi 0 8])
grid
ylabel('Magnitude')
subplot(212)
plot(w,angle(H))
axis([0 2*pi -pi pi])
grid
ylabel('Phase (rad)')

ECE 2610 Signals and Systems

64

Sinusoidal Response of FIR Systems

>> xlabel('hat(\omega) (rad)')

Magnitude

8
6
4

3.248
2
0

6 2

6 2

Phase (rad)

2
0
2

-2
0

3
hat() (rad)

Example: Find y n for Input x n = 5e

j1 n

0 = 1 rad, the amplitude is 5, and


The input frequency is
the phase is = 0
Assuming x n is input to the 4-tap FIR filter in the previous
example, the filter output is
y n = 3 + 2 cos 1 + 2 cos 2 1 e
= 16.2415e

j2

j 1 2

5e

j1 n

jn

0 = 1 is H e j1 =
The amplitude response or gain at
3.248; why?

ECE 2610 Signals and Systems

65

Superposition and the Frequency Response

Superposition and the Frequency Response


We can use the linearity of the FIR filter to compute the output to a sum of sinusoids input signal
As a special case we first consider a single real sinusoid
0n +
x n = A cos

(6.7)

Using Eulers formula we expand (6.7)


A j n + A j 0 n +
x n = --- e 0
+ --- e
2
2

(6.8)

The filter output due to each complex sinusoid is known from


(6.3), so now using superposition we can write

n + A

0n +
A
j
j
j
j
y n = --- H e 0 e 0
+ --- H e 0 e
2
2

(6.9)

We can simplify this result to a nice compact form, if we


make the assumption that the FIR filter has real coefficients
Special Result: It will be shown in a later section of this
chapter that an FIR filter with real coefficients has conjugate
symmetry
He

= H*e

(6.10)

What does this mean?


He

= Re H e jIm H e

= H e H e

ECE 2610 Signals and Systems

66

Superposition and the Frequency Response

We now use (6.10) to simplify (6.9)


0 j
0n + A
0 j
0n +
j
j
A
*
--y n = H e e
+ H e e
2
2

= A He

0
j

0 n + + H e j
j

0 n + + H e j
j

+e
e
------------------------------------------------------------------------------------------------2
yn = A He

0
j

(6.11)

0 n + + H e j 0
cos

We see that when a real sinusoid passes through an LTI system, such as an FIR filter (having real coefficients), the output is also a real sinusoid which has picked up the magnitude
=

and phase of the system at


0
The generalization (sum of sinusoids) of this result is when
N

x n = X0 +

k n + X ,
X k cos
k

(6.12)

k=1

then the corresponding LTI system output is


j0

y n = X0 H e
N

Xk H e

k
j

k n + X + H e j k
cos
k

(6.13)

k=1

ECE 2610 Signals and Systems

67

Superposition and the Frequency Response

Example: Three Inputs with b k = 1 1 1


The input is

x n = 10 + 4 cos --- n +
--- + 3 cos --- n ---
3
4
4
8
The frequency response is

He = 1 e
= e

+e

j2


1 + 2 cos

k = 0 4 3
The input frequencies are
j0

He = e

j0

1 + 2 cos 0 = 1

He

j 4

= e

j 4

1 + 2 cos 4 = 0.4142e

He

j 3

= e

j 3

1 + 2 cos 3 = 0

j 4

Thus

y n = 10 1 + 4 0.4142 cos --- n +


---
---
4
8 4

= 10 + 1.6569 cos --- n


---
4
8
>>
>>
>>
>>
>>
>>
>>

w = 0:pi/200:pi;
H = 1 - exp(-j*w) + exp(-j*2*w);
subplot(211)
plot(w,abs(H))
grid
hold
plot([pi/4 pi/4],[0 3],'r')

ECE 2610 Signals and Systems

68

Superposition and the Frequency Response

>>
>>
>>
>>
>>
>>
>>
>>
>>

plot([pi/3 pi/3],[0 3],'r')


ylabel('Magnitude')
subplot(212)
plot(w,angle(H))
grid
hold
plot([pi/4 pi/4],[-2 3],'r')
ylabel('Phase (rad)')
xlabel('Digital Frequency \omega')

j
He

Magnitude

2.5
2

0.4142

1.5

1
0.5
0

0.5

--4

--3

1.5

2.5

3.5

1.5

2.5

3.5

Phase (rad)

--4

1
0
1
2

0.5

Digital Frequency

We have used frequency domain analysis to complete this


example
We could also perform a time domain analysis using say
MATLABs filter function (more on this in the next section)

ECE 2610 Signals and Systems

69

Steady-State and Transient Response

Steady-State and Transient Response


The frequency response definition relies on the fact that the
support interval for the complex sinusoid input is
In a computer simulation or in a real-time signal processing
application, it is not practical to consider input signals which
begin at
Consider an input that begins at n = 0 using the unit step
function to turn on the input
x n = Xe
where X = Ae

n
j

un

(6.14)

and

1, n 0
un
0, otherwise

(6.15)

For an LTI FIR system, the convolution sum formula yields


y n =

b k Xe

n k
j

un k

(6.16)

k=0
hk

un k

...
n

ECE 2610 Signals and Systems

610

Steady-State and Transient Response

The sum of (6.16) is composed of three cases

yn =

n0

0,

bk e

k
j

Xe

k=0

n
j

, 0nM
(6.17)

M
k
n
j
j
Xe
b
e
, nM

k
k = 0

When n 0 the input is not present, so the output is zero


When 0 n M the input has partially engaged the filter and
the output produced is the transient response
When n M , the output is in steady-state, since the input has
fully engaged the filter
Note that the steady-state response is also equivalent to
saying

y n = H e Xe n M

(6.18)

Note also that the steady-state output assumes that the


n
j
input is always Xe
for n 0
Example: Revisit Three Inputs with b k = 1 1 1
The frequency domain analysis used in the previous example
obtained just the steady-state portion of the output
We can evaluate the convolution sum or use MATLABs filter
function to obtain a solution of the form described in (6.17)
ECE 2610 Signals and Systems

611

Steady-State and Transient Response

>> n = -5:20;
>> x = (10 + 4*cos(pi/4*n+pi/8) + ...
3*cos(pi/3*n-pi/4)).*ustep(n,0);
>> y = filter([1 -1 1],1,x);
>> subplot(211)
>> stem(n,x,'filled')
>> grid
>> ylabel('x[n]')
>> subplot(212)
>> stem(n,y,'filled')
>> hold
Current plot released
>> stem(n,y,'filled')
>> grid
>> ylabel('y[n]')
>> xlabel('Sample Index n')
20

x[n]

15

10

0
5

10

15

20

10

15

20

Transient
Interval

20
15

y[n]

10
5
0
5
5

Steady-state
0

5
Sample Index n

ECE 2610 Signals and Systems

612

Steady-State and Transient Response

The function ustep() is defined as:


function x = ustep(n,n0)
% function x = ustep(n,n0)
%
% Generate a time shifted unit step sequence
x = zeros(size(n));
i_n0 = find(n >= n0);
x(i_n0) = ones(size(i_n0));

If we consider just the steady-state portion of the output we


should be able to discern the same output as obtained from
the frequency domain analysis of the previous example
12

2 1.6568 = 3.3138

11.5

11

y[n]

10.5

DC = 10
10

y[n] peak
lag 1/2
sample =
/8

9.5

8.5

x[n] cos() peak

10

15

20

Sample Index n

The measurements above agree with the earlier example

ECE 2610 Signals and Systems

613

Properties of the Frequency Response

Properties of the Frequency Response


Relation to Impulse Response and Difference Equation
In the definition of the frequency response, H e j , for an
FIR filter, the coefficients b k were utilized

Similarly given the frequency response, the impulse response


can be found
Time Domain Frequency Domain
M

hn =

h k n k H e =

k=0

h k e

k
j

k=0

In Chapter 5 we saw that the impulse response and difference


equation are directly related, so in summary given one the
other two are easy to obtain

Example: h n H e
Given say
h n = 2 n + 3 n 1 2 n 2
we immediately see that b k = 2 3 2
The difference equation is
y n = 2x n + 3x n 1 2x n 2
The frequency response is

H e = 2 + 3e

ECE 2610 Signals and Systems

2e

j 2

614

Properties of the Frequency Response

Example: Difference Equation from H e j

Suppose that

H e = 1 + 4e

j 2

+ 4e

j 4

We immediately can write that


h n = n + 4 n 2 + 4 n 4
and
y n = x n + 4x n 2 + 4x n 4
It could have been that

H e = 1 + 8e
= 1 + 8e

e
j2

j2

j2

+ e -
---------------------------

j2

cos 2

started in this form

2 e j 2
Example: H e j = 2j sin

We need to convert the sine form back to complex exponentials

H e = 2je

2 e
j

= 1e

2
j

2
j

e
----------------------------------
2j

The impulse response is thus?

ECE 2610 Signals and Systems

615

Properties of the Frequency Response

The difference equation is?

Periodicity of H e j

For any discrete-time LTI system, the frequency response is


periodic, that is
He

+ 2
j

He

(6.19)

The proof for FIR filters follows


He

+ 2
j

bk e

+ 2
j

k=0

bk e

k=0

j2

= He

(6.20)
This result is consistent with the fact that sinusoidal signals
are insensitive to 2 frequency shifts, i.e.,
x n = Xe

+ 2 n
j

= Xe

n j2n
j

= Xe

n
j

In summary, the frequency response is unique on at most a



2 interval, say in particular the interval
Conjugate Symmetry

The frequency response H e is in general a complex


quantity, in most cases obeys certain symmetry properties
ECE 2610 Signals and Systems

616

Properties of the Frequency Response

In particular if the coefficients of a digital filter are real, that


is b k = b *k or h k = h * k , then
Conjugate Symmetry: H e

= H * e

(6.21)

proof
M
k *

j
*
bk e
H e =
=
k = 0

bk e

k
j

b *k e

k
j

k=0

= He

(6.22)

k=0

A consequence of conjugate symmetry is that


He

H e

= He

= H e

(6.23)

We say that the magnitude response is an even function of


and the phase is an odd function of

It also follows that


Re H e

Im H e

= Re H e

(6.24)

= Im H e

We say that the real part response is an even function of

and the imaginary part is an odd function of


When plotting the frequency response we can use the above

symmetry to just plot over the interval 0
ECE 2610 Signals and Systems

617

Graphical Representation of the Frequency Response

Graphical Representation of the Frequency


Response
A useful MATLAB function for plotting the frequency
response of any discrete-time (digital) filter is freqz()
The interface to freqz() is similar to filter() in that a
and b vectors are again required
Recall that the b vector holds the FIR coefficients b k
and for FIR filters we set a = 1.
>> help freqz
FREQZ Digital filter frequency response.
[H,W] = FREQZ(B,A,N) returns the N-point complex frequency response
vector H and the N-point frequency vector W in radians/sample of
the filter:
jw
-jw
-jmw
jw B(e)
b(1) + b(2)e + .... + b(m+1)e
H(e) = ---- = -----------------------------------jw
-jw
-jnw
A(e)
a(1) + a(2)e + .... + a(n+1)e
given numerator and denominator coefficients in vectors B and A. The
frequency response is evaluated at N points equally spaced around the
upper half of the unit circle. If N isn't specified, it defaults to
512.
[H,W] = FREQZ(B,A,N,'whole') uses N points around the whole unit circle.
H = FREQZ(B,A,W) returns the frequency response at frequencies
designated in vector W, in radians/sample (normally between 0 and pi).
[H,F] = FREQZ(B,A,N,Fs) and [H,F] = FREQZ(B,A,N,'whole',Fs) return
frequency vector F (in Hz), where Fs is the sampling frequency (in Hz).
H = FREQZ(B,A,F,Fs) returns the complex frequency response at the
frequencies designated in vector F (in Hz), where Fs is the sampling
frequency (in Hz).
FREQZ(B,A,...) with no output arguments plots the magnitude and
unwrapped phase of the filter in the current figure window.
See also filter, fft, invfreqz, fvtool, and freqs.

ECE 2610 Signals and Systems

618

Graphical Representation of the Frequency Response

Example: Delay System y n = x n n 0


This filter contains one coefficient, b n0 = 1 , so

He = e

Phase Response (rad)

Magnitude Response

>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

n0
j

n0
= 1

[H,w] = freqz([0 0 0 0 1],1);


subplot(211)
plot(w,abs(H))
axis([0 pi 0 1.2]); grid
ylabel('Magniude Response')
subplot(212)
plot(w,angle(H))
axis([0 pi -pi pi]); grid
ylabel('Phase Response (rad)')
xlabel('hat(\omega)')
Constant magnitude (gain) response

n0 = 4

0.5

0.5

1.5

2.5

2.5

Linear Phase

2
0

MATLAB
wraps the
phase mod2

0.5

ECE 2610 Signals and Systems

1.5
hat()

619

Graphical Representation of the Frequency Response

Example: First-Difference System y n = x n x n 1


The frequency response is

He = 1 e

+ j sin

= 1 cos

w = -pi:pi/100:pi;
H = freqz([1 -1],1,w); %use a custom w axis
subplot(211)
plot(w,abs(H))
axis([-pi pi 0 2]); grid; ylabel('Magniude Response')
subplot(212)
plot(w,angle(H))
axis([-pi pi -2 2]); grid;
ylabel('Phase Response (rad)')
xlabel('hat(\omega)')

Phase Response (rad)

Magnitude Response

>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

2
2 sin

1.5
1
0.5
0

0
hat()

2
1

sin
atan ----------------------
1 cos

0
1
2

ECE 2610 Signals and Systems

620

Graphical Representation of the Frequency Response

Example: A Simple Lowpass Filter


y n = x n + 2x n 1 + x n 2
The frequency response is

H e = 1 + 2e

+e

j2

= e

2 + 2 cos

w = -pi:pi/100:pi;
H = freqz([1 2 1],1,w);
subplot(211)
plot(w,abs(H))
axis([-pi pi 0 4]); grid;
ylabel('Magnitude Response')
subplot(212)
plot(w,angle(H))
axis([-pi pi -pi pi]); grid;
ylabel('Phase Response (rad)')
xlabel('hat(\omega)')

Phase Response (rad)

Magnitude Response

>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

4
3

2 + 2 cos

2
1
0

0
hat()

0
2
3

ECE 2610 Signals and Systems

621

Cascaded LTI Systems

Cascaded LTI Systems


Cascaded LTI system were discussed in Chapter 5 from the
time-domain standpoint
In the frequency-domain there is an alternative view of the
input/output relationships

To begin with consider again


xn = e

n
j

(6.25)

is
With LTI #1 followed by LTI #2, the output at frequency

y 1 n = H 2 e H 1 e e

= H 2 e H 1 e e

ECE 2610 Signals and Systems

n
j

n
j

(6.26)

622

Cascaded LTI Systems

is
With LTI #2 followed by LTI #1, the output at frequency

y 2 n = H 1 e H 2 e e

= H 1 e H 2 e e

n
j

(6.27)

n
j

Since H 1 e H 2 e = H 2 e H 1 e , it follows that


y 1 n = y 2 n , and we have established that the frequency
response for a cascaded system is simply the product of the
frequency responses

H cascade e = H e = H 1 e H 2 e

(6.28)

We have also shown that a convolution in the time-domain is


equivalent to a multiplication in the frequency-domain
Time Domain Frequency Domain

h n = h 1 n * h 2 n H 1 e H 2 e = H e

(6.29)

Example: Two System Cascade


Consider

H1 e = 1 + e

H 2 e = 1 + 2e

+e

j2

The cascade frequency response is

He = 1 + e

= 1 + 3e
ECE 2610 Signals and Systems

1 + 2e

+ 3e

j2

+e

+e

j2

j3

623

Moving Average Filtering

Given the cascade frequency response we can easily convert


back to the impulse response of the cascade difference equation
h n = n + 3 n 1 + 3 n 2 + n 3
and
y n = x n + 3x n 1 + 3x n 2 + x n 3
Check h 1 n * h 2 n

Moving Average Filtering


The moving average filter occurs frequency enough that we
should consider finding a general expression for the frequency response
The difference equation for an L-point averager is
1
y n = --L

L1

xn k

(6.30)

k=0

The frequency response is


1 L 1 j k
H e = --e
L

(6.31)

k=0

ECE 2610 Signals and Systems

624

Moving Average Filtering

This sum is known as a finite geometric series


It can be shown (discussed in class) that

k
=

k=0

L1

1------------- , 1
1
L,
= 1 (why?)

Apply (6.32) to (6.31) by setting = e

(6.32)

1 e j L
1
H e = --- ----------------------

L
j
1e

e j L 2 e j L 2 e j L 2
1
= --- ----------------------------------------------------------------
L j 2 j 2 j 2
e
e

e

(6.33)

L 2 j L 1 2
sin
= --------------------------- e
L sin
2
Notice that the phase response is composed of a linear term
L 1 2
j
L 2 /
and due to the sign changes of sin
e
2
L sin
In MATLAB

L 2
j
sin
L = -------------------------D L e = diric
2
L sin

can be used for analyzing moving average filters

ECE 2610 Signals and Systems

625

Moving Average Filtering

Plotting the Frequency Response


The frequency response can be plotted most easily using
MATLABs freqz() function
Consider a 10-point moving average
w = -pi:pi/500:pi;
H = freqz(ones(1,10)/10,1,w);
subplot(211)
plot(w,abs(H))
grid; axis([-pi pi 0 1])
ylabel('Magnitude Response')
subplot(212)
plot(w,angle(H))
grid; axis([-pi pi -pi pi])
ylabel('Phase Response (rad)')
xlabel('hat(\omega)')

Phase Response (rad)

Magnitude Response

>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

L = 10

2
= ----
L

0.5

--5

1 2
-----5

j4.5

3
------ 2
5

4
-----5

on this segment

0
2
3

ECE 2610 Signals and Systems

0
hat()

626

Filtering Sampled Continuous-Time Signals

Filtering Sampled Continuous-Time Signals


Consider the system model as shown below

Suppose that
x t = Xe

jt

(6.34)

We know that after sampling we have


x n = x nT s = Xe

jnT s

= Xe

n
j

(6.35)

The key relationship to connect the continuous-time and the


discrete-time quantities is
= T = 2 --f
s
fs

f
= ----- =
s
Ts

(6.36)

----f = ------------ = - f s
2
2T s
As long as the input analog frequency satisfies the sampling
theorem, i.e., T s or f f s 2 , the output of the discrete-time system will be
ECE 2610 Signals and Systems

627

Filtering Sampled Continuous-Time Signals

y n = H e Xe

n
j

(6.37)

We can write y n in terms of the analog frequency variable


= T s
via
yn = He

jT s

Xe

jT s n

(6.38)

At the output of the D-to-C converter we have the reconstructed output


yt = He
= He

jT s

Xe

j2f f s

jt

Xe

j 2f f s t

(6.39)

where f is the input analog sinusoid frequency (perhaps a bet 0)


ter notation would be f 0 0
Example: Lowpass Averager
Consider a 5-point moving average filter wrapped up
between a C-to-D and D-to-C system
We assume a sampling rate of 1000 Hz and an input composed of two sinusoids
x t = cos 2 100 t + 3 cos 2 300 t
Find the system frequency response in terms of the analog
frequency variable f, and find the steady-state output y t
We will use freqz() to obtain the frequency response
>> w = -pi:pi/100:pi;
>> H = freqz(ones(1,5)/5,1,w);
>> subplot(211)
ECE 2610 Signals and Systems

628

Filtering Sampled Continuous-Time Signals

plot(w,abs(H))
axis([-pi pi 0 1]); grid
ylabel('Magnitude Response')
subplot(212)
plot(w,angle(H))
axis([-pi pi -pi pi]); grid
ylabel('Phase Response (rad)')
xlabel('hat(\omega)')

Phase Response (rad)

Magnitude Response

>>
>>
>>
>>
>>
>>
>>
>>

>>
>>
>>
>>
>>
>>
>>
>>
>>

j
Magnitude and Phase Plots of H e

0.5

0
hat()

2
0
2

subplot(211)
plot(w*1000/(2*pi),abs(H))
grid
ylabel('Magnitude Response')
subplot(212)
plot(w*1000/(2*pi),angle(H))
grid
ylabel('Phase Response (rad)')
xlabel('f (Hz)')

ECE 2610 Signals and Systems

629

Filtering Sampled Continuous-Time Signals

Phase Response (rad)

Magnitude Response

Magnitude and Phase Plots of H e

j2f f s

0.5

0
500

400

300

200

100

100

200

300

400

500

400

300

200

100

0
f (Hz)

100

200

300

400

500

4
2
0
2
4
500

The output y t will be of the same form as the input x t ,


except the sinusoids at 100 and 300 Hz need to have the filter
frequency response applied
Note 100 Hz and 300 Hz < 1000/2 = 500 Hz (no aliasing)
To properly apply the filter frequency response we need to
convert the analog frequencies to the corresponding discretetime frequencies
100
100Hz 2 ------------ = 2 0.1 = 0.2
1000
300
300Hz 2 ------------ = 2 0.3 = 0.6
1000
ECE 2610 Signals and Systems

(6.40)

630

Filtering Sampled Continuous-Time Signals

The frequency response for L = 5 in the general moving


average filter is
j2
sin 2.5
--------------------------e
He =

5 sin 2

(6.41)

The frequency response at these two frequencies is


sin 2.5 0.2 j2 0.2
j0.4
= --------------------------------------- e
= 0.6472e
5 sin 0.2 2
(6.42)
j0.6
j1.2
sin 2.5 0.6 j2 0.6
= --------------------------------------- e
= 0.2472e
He
5 sin 0.6 2
j0.2

He

0.2472e

j0.2

>> diric(0.2*pi,5)
ans = 0.6472
>> diric(0.6*pi,5)
ans = -0.2472 % also = 0.2472 at angle +/- pi

The filter output y n is


y n = 0.6472 cos 0.2n 0.4
+ 0.7416 cos 0.2n 1.2 +

(6.43)

and the D-to-C output is


y t = 0.6472 cos 2 100 t 0.4
+ 0.7416 cos 2 300 t 0.2

ECE 2610 Signals and Systems

(6.44)

631

Filtering Sampled Continuous-Time Signals

Interpretation of Delay
In the study of the moving average filter, it was noted that

H e = D L e e

L 1 2
j

where D L e is a purely real function


The pure delay system
y n = x n n0
has impulse response
h n = n n0
and has frequency response

He = e

jn 0

We also know that the impulse response of two systems in


cascade is
h n = h1 n * h2 n

H e = H 1 e H 2 e
The L-point moving average filter thus incorporates a delay
of L 1 2 samples
Viewed as a cascade of subsystems

H e = DL e e

L 1 2
j

(6.45)

If L is odd then the delay is an integer


If L is even then the delay is an odd half integer
ECE 2610 Signals and Systems

632

You might also like