Top Banner
ECE 2610 Signal and Systems 6–1 Frequency Response of FIR Filters 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 . 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 , (6.1) where it could be that was obtained by sampling the complex sinusoid and From the difference equation for an tap FIR filter, (6.2) xn e j ˆ 0 n n = xn Ae j e j ˆ 0 n n = xn xt Ae j e j 0 t = ˆ 0 0 T s = M 1 + yn b k xn k k 0 = M b k Ae j e j ˆ 0 n k k 0 = M = = Chapter 6
32

Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Mar 11, 2018

Download

Documents

dangdiep
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

er

Frequency Response of FIR FiltersThis chapter continues the study of FIR filters from Chapter 5,but the emphasis is frequency response, which relates to how thefilter responds to an input of the form

.

A fundamental result we shall soon see, is that the frequencyresponse and impulse response are related through an operationknown as the Fourier transform. The Fourier transform itself isnot however formally studied in this chapter.

Sinusoidal Response of FIR Systems

• Consider an FIR filter when the input is a complex sinusoidof the form

, (6.1)

where it could be that was obtained by sampling thecomplex sinusoid and

• From the difference equation for an tap FIR filter,

(6.2)

x n ej0n – n =

x n Aejej0n – n =

x n x t Ae

jej0t= 0 0Ts=

M 1+

y n bkx n k– k 0=

M

bkAejej0 n k–

k 0=

M

= =

Chapt

6

ECE 2610 Signal and Systems 6–1

Page 2: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Sinusoidal Response of FIR Systems

(6.3)

where we have defined for arbitrary

(6.4)

to be the frequency response of the FIR filter

• Note: The notation is used rather than say , tobe consistent with the z-transform which will defined inChapter 7, and to emphasize the fact that the frequencyresponse is periodic, with period (more on this later)

– Note: , where sine and cosine areboth functions

• Returning to (6.2), the implication is that when the input is acomplex exponential at frequency , the output is also acomplex exponential at frequency

• The complex amplitude (magnitude and phase) of the input ischanged as a result of passing through the system

– The frequency response at multiplies the input ampli-tude to produce the output

– It is not true in general that , butonly for the special case of a complex sinusoidapplied starting at

y n Aejej0n

bkej– 0k

k 0=

M

=

Aejej0n

H ej0 – n =

H ej bke

j– k

k 0=

M

=

H ej H

2

ej j sin+cos=mod 2

0

0

0

y n H ej0 x n =x n

ECE 2610 Signals and Systems 6–2

Page 3: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Sinusoidal Response of FIR Systems

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

(6.5)

– The polar or magnitude and phase form is perhaps themost common

• The polar form offers the following interpretation of interms of , when the input is a complex sinusoid

(6.6)

– Here we see that the input amplitude is multiplied by thefrequency response amplitude, and the input phase hasadded to it the frequency response phase

– The output amplitude expression means that isalso termed the gain of an LTI system

Example:

• The frequency response of this FIR filter is

H ej H e

j ej H ej =

Re H ej jIm H e

j +=

y n x n

y n H ej ej H ej

Aejejn

=

H ej Aej H ej +

ejn

=

H e j

bk 1 1 3 1 1 =

H ej bke

jk–

k 0=

4

=

1 ej–

3ej– 2

ej– 3

ej– 4

+ + + +=

ECE 2610 Signals and Systems 6–3

Page 4: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Sinusoidal Response of FIR Systems

– We have used the inverse Euler formula for cosine twice

• For this particular filter we have that

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)')

H ej e

j2–ej2

ej

3 ej–

ej2–

+ + + + =

ej2–

2 2 2 3+cos+cos =

H ej 3 2 cos 2 2 cos+ +=

H ej 2–=

ECE 2610 Signals and Systems 6–4

Page 5: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Sinusoidal Response of FIR Systems

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

Example: Find for Input

• The input frequency is rad, the amplitude is 5, andthe phase is

• Assuming is input to the 4-tap FIR filter in the previousexample, the filter output is

• The amplitude response or gain at is =3.248; why?

0 1 2 3 4 5 60

2

4

6

8

Mag

nitu

de

0 1 2 3 4 5 6

−2

0

2

Pha

se (

rad)

hat(ω) (rad)

2

2

3.248

-2

y n x n 5ej 1 n

=

0 1= 0=

x n

y n 3 2 1 cos 2 2 1 cos+ + e j 1 2 –5ej 1 n

=

16.2415ej2–ejn=

0 1= H ej1

ECE 2610 Signals and Systems 6–5

Page 6: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Superposition and the Frequency Response

Superposition and the Frequency Response

• We can use the linearity of the FIR filter to compute the out-put to a sum of sinusoids input signal

• As a special case we first consider a single real sinusoid

(6.7)

• Using Euler’s formula we expand (6.7)

(6.8)

• The filter output due to each complex sinusoid is known from(6.3), so now using superposition we can write

(6.9)

• We can simplify this result to a nice compact form, if wemake the assumption that the FIR filter has real coefficients

• Special Result: It will be shown in a later section of thischapter that an FIR filter with real coefficients has conjugatesymmetry

(6.10)

– What does this mean?

x n A 0n + cos=

x n A2---ej 0n + A

2---e

j– 0n + +=

y n A2---H e

j0 ej 0n + A2---H e

j– 0 e j– 0n + +=

H ej– H* e

j =

H ej– Re H e

j jIm H ej –=

H ej H e

j – =

ECE 2610 Signals and Systems 6–6

Page 7: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Superposition and the Frequency Response

• We now use (6.10) to simplify (6.9)

(6.11)

• We see that when a real sinusoid passes through an LTI sys-tem, such as an FIR filter (having real coefficients), the out-put is also a real sinusoid which has picked up the magnitudeand phase of the system at

• The generalization (sum of sinusoids) of this result is when

, (6.12)

then the corresponding LTI system output is

(6.13)

y n A2---H e

j0 ej 0n + A2---H* e

j0 e j– 0n + +=

A H ej0 =

ej 0n H ej + +

ej– 0n H ej + +

+2

-------------------------------------------------------------------------------------------------

y n A H ej0 0n H e

j0 + + cos=

0=

x n X0 Xk kn Xk+ cosk 1=

N

+=

y n X0H ej0 =

Xk H ejk kn Xk H e jk + + cos

k 1=

N

+

ECE 2610 Signals and Systems 6–7

Page 8: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Superposition and the Frequency Response

Example: Three Inputs with

• The input is

• The frequency response is

• The input frequencies are

• Thus

>> 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')

bk 1 1– 1 =

x n 10 44---n

8---+

cos 33---n

4---–

cos+ +=

H ej 1 e

j–– e

j2–+=

ej–

1– 2 cos+ =

k 0 4 3 =

H ej0 e

j0–1– 2 0 cos+ 1= =

H ej 4 e

j 4–1– 2 4 cos+ 0.4142e

j 4–= =

H ej 3 e

j 3–1– 2 3 cos+ 0= =

y n 10 1 4 0.41424---n

8---

4---–+

cos+=

10= 1.65694---n

8---–

cos+

ECE 2610 Signals and Systems 6–8

Page 9: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

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')

• We have used frequency domain analysis to complete thisexample

• We could also perform a time domain analysis using sayMATLAB’s filter function (more on this in the next section)

0 0.5 1 1.5 2 2.5 3 3.50

0.5

1

1.5

2

2.5

3

Mag

nitu

de

0 0.5 1 1.5 2 2.5 3 3.5−2

−1

0

1

2

3

Digital Frequency ω

Pha

se (

rad)

H ej

4---

3---

4---–

0.4142 0

ECE 2610 Signals and Systems 6–9

Page 10: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Steady-State and Transient Response

Steady-State and Transient Response

• The frequency response definition relies on the fact that thesupport interval for the complex sinusoid input is

• In a computer simulation or in a real-time signal processingapplication, it is not practical to consider input signals whichbegin at

• Consider an input that begins at using the unit stepfunction to turn on the input

(6.14)

where and

(6.15)

• For an LTI FIR system, the convolution sum formula yields

(6.16)

n 0=

x n Xejnu n =

X Aej

=

u n 1, n 00, otherwise

y n bkXej n k–

u n k– k 0=

M

=

h k

k0 M

kn 0

. . .

u n k–

ECE 2610 Signals and Systems 6–10

Page 11: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Steady-State and Transient Response

• The sum of (6.16) is composed of three cases

(6.17)

• When the input is not present, so the output is zero

• When the input has partially engaged the filter andthe output produced is the transient response

• When , the output is in steady-state, since the input hasfully engaged the filter

– Note that the steady-state response is also equivalent tosaying

(6.18)

– Note also that the steady-state output assumes that theinput is always for

Example: Revisit Three Inputs with

• The frequency domain analysis used in the previous exampleobtained just the steady-state portion of the output

• We can evaluate the convolution sum or use MATLAB’s filterfunction to obtain a solution of the form described in (6.17)

y n

0, n 0

bkejk–

k 0=

n

Xejn

, 0 n M

bkejk–

k 0=

M

Xejn

, n M

=

n 0

0 n M

n M

y n H ej Xej n M=

Xejn

n 0

bk 1 1– 1 =

ECE 2610 Signals and Systems 6–11

Page 12: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

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')>> holdCurrent plot released>> stem(n,y,'filled')>> grid>> ylabel('y[n]')>> xlabel('Sample Index n')

−5 0 5 10 15 200

5

10

15

20

x[n]

−5 0 5 10 15 20−5

0

5

10

15

20

y[n]

Sample Index n

TransientInterval

Steady-state

ECE 2610 Signals and Systems 6–12

Page 13: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

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 weshould be able to discern the same output as obtained fromthe frequency domain analysis of the previous example

• The measurements above agree with the earlier example

5 10 15 208

8.5

9

9.5

10

10.5

11

11.5

12

y[n]

Sample Index n

2 1.6568 3.3138=

x[n] cos() peak

y[n] peaklag 1/2 sample = /8

DC = 10

ECE 2610 Signals and Systems 6–13

Page 14: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Properties of the Frequency Response

Properties of the Frequency Response

Relation to Impulse Response and Difference Equation

• In the definition of the frequency response, , for anFIR filter, the coefficients were utilized

• Similarly given the frequency response, the impulse responsecan be found

• In Chapter 5 we saw that the impulse response and differenceequation are directly related, so in summary given one theother two are easy to obtain

Example:

• Given say

we immediately see that

• The difference equation is

• The frequency response is

H e j bk

Time Domain Frequency Domain

h n h k n k– k 0=

M

= H ej h k e jk–

k 0=

M

=

h n H ej

h n 2 n 3 n 1– 2 n 2– –+=

bk 2 3 2– =

y n 2x n 3x n 1– 2x n 2– –+=

H ej 2 3e

j– 2e

j– 2–+=

ECE 2610 Signals and Systems 6–14

Page 15: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Properties of the Frequency Response

Example: Difference Equation from

• Suppose that

• We immediately can write that

and

• It could have been that

started in this form

Example:

• We need to convert the sine form back to complex exponen-tials

• The impulse response is thus?

H ej

H ej 1 4e

j– 24e

j– 4+ +=

h n n 4 n 2– 4 n 4– + +=

y n x n 4x n 2– 4x n 4– + +=

H ej 1 8e

j2– ej2

ej2–

+2

-----------------------------

+=

1 8ej2–

2 cos+=

H ej 2j 2 e j 2–sin=

H ej 2je

j 2 – ej 2

ej– 2

–2j

----------------------------------

=

1 ej–

–=

ECE 2610 Signals and Systems 6–15

Page 16: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Properties of the Frequency Response

• The difference equation is?

Periodicity of

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

(6.19)

• The proof for FIR filters follows

(6.20)

• This result is consistent with the fact that sinusoidal signalsare insensitive to frequency shifts, i.e.,

• In summary, the frequency response is unique on at most a interval, say in particular the interval

Conjugate Symmetry

• The frequency response is in general a complexquantity, in most cases obeys certain symmetry properties

H e j

H ej 2+ H e

j

H ej 2+ bke

j 2+ –

k 0=

M

=

bkej–

ej2–

k 0=

M

H ej ==

1

2

x n Xej 2+ n

Xejnej2n

Xejn

= = =

2 –

H ej

ECE 2610 Signals and Systems 6–16

Page 17: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Properties of the Frequency Response

• In particular if the coefficients of a digital filter are real, thatis or , then

(6.21)

proof

(6.22)

• A consequence of conjugate symmetry is that

(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

(6.24)

– 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 abovesymmetry to just plot over the interval

bk bk*= h k h* k =

Conjugate Symmetry: H ej– H* e

j =

H* ej bke

jk–

k 0=

M

*

bk*ejk

k 0=

M

= =

bkej– – k

k 0=

M

H ej– ==

H ej– H e

j =

H ej– H e

j –=

Re H ej– Re H e

j =

Im H ej– Im H e

j –=

0

ECE 2610 Signals and Systems 6–17

Page 18: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Graphical Representation of the Frequency Response

Graphical Representation of the Frequency Response

• A useful MATLAB function for plotting the frequencyresponse of any discrete-time (digital) filter is freqz()

• The interface to freqz() is similar to filter() in that aand b vectors are again required

– Recall that the b vector holds the FIR coefficients 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.

bk

ECE 2610 Signals and Systems 6–18

Page 19: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Graphical Representation of the Frequency Response

Example: Delay System

• This filter contains one coefficient, , so

>> [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)')

y n x n n0– =

bn01=

H ej e

jn0–1 n0–= =

0 0.5 1 1.5 2 2.5 30

0.5

1

Mag

nitu

de R

espo

nse

0 0.5 1 1.5 2 2.5 3

−2

0

2

Pha

se R

espo

nse

(rad

)

hat(ω)

n0 4=

4–

Constant magnitude (gain) response

Linear Phase

MATLABwraps thephase mod2

ECE 2610 Signals and Systems 6–19

Page 20: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Graphical Representation of the Frequency Response

Example: First-Difference System

• The frequency response is

>> 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)')

y n x n x n 1– –=

H ej 1 e

j–– 1 cos– j sin+= =

−3 −2 −1 0 1 2 30

0.5

1

1.5

2

Mag

nitu

de R

espo

nse

−3 −2 −1 0 1 2 3−2

−1

0

1

2

Pha

se R

espo

nse

(rad

)

hat(ω)

2 2 sin

sin1 cos–---------------------- atan

ECE 2610 Signals and Systems 6–20

Page 21: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Graphical Representation of the Frequency Response

Example: A Simple Lowpass Filter

• The frequency response is

>> 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)')

y n x n 2x n 1– x n 2– + +=

H ej 1 2e

j–ej2

+ + ej–

2 2 cos+ = =

−3 −2 −1 0 1 2 30

1

2

3

4

Mag

nitu

de R

espo

nse

−3 −2 −1 0 1 2 3

−2

0

2

Pha

se R

espo

nse

(rad

)

hat(ω)

2 2 cos+

ECE 2610 Signals and Systems 6–21

Page 22: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Cascaded LTI Systems

Cascaded LTI Systems

• Cascaded LTI system were discussed in Chapter 5 from thetime-domain standpoint

• In the frequency-domain there is an alternative view of theinput/output relationships

• To begin with consider again

(6.25)

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

(6.26)

x n ejn – n =

y1 n H2 ej H1 e

j ejn =

H2 ej H1 e

j ejn=

ECE 2610 Signals and Systems 6–22

Page 23: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Cascaded LTI Systems

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

(6.27)

• Since , it follows that, and we have established that the frequency

response for a cascaded system is simply the product of thefrequency responses

(6.28)

• We have also shown that a convolution in the time-domain isequivalent to a multiplication in the frequency-domain

(6.29)

Example: Two System Cascade

• Consider

• The cascade frequency response is

y2 n H1 ej H2 e

j ejn =

H1 ej H2 e

j ejn=

H1 ej H2 e

j H2 ej H1 e

j =y1 n y2 n =

Hcascade ej H e

j H1 ej H2 e

j = =

Time Domain Frequency Domain

h n h1 n *h2 n = H1 ej H2 e

j H ej =

H1 ej 1 e

j– +=

H2 ej 1 2e

j–ej2–

+ +=

H ej 1 e

j– + 1 2e

j–ej2–

+ + =

1 3ej–

3ej2–

ej3–

+ + +=

ECE 2610 Signals and Systems 6–23

Page 24: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Moving Average Filtering

• Given the cascade frequency response we can easily convertback to the impulse response of the cascade difference equa-tion

and

• Check

Moving Average Filtering

• The moving average filter occurs frequency enough that weshould consider finding a general expression for the fre-quency response

• The difference equation for an L-point averager is

(6.30)

• The frequency response is

(6.31)

h n n 3 n 1– 3 n 2– n 3– + + +=

y n x n 3x n 1– 3x n 2– x n 3– + + +=

h1 n *h2 n

y n 1L--- x n k– k 0=

L 1–

=

H ej 1

L--- e

jk–

k 0=

L 1–

=

ECE 2610 Signals and Systems 6–24

Page 25: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Moving Average Filtering

• This sum is known as a finite geometric series

• It can be shown (discussed in class) that

(6.32)

• Apply (6.32) to (6.31) by setting

(6.33)

• Notice that the phase response is composed of a linear term and due to the sign changes of /

• In MATLAB

can be used for analyzing moving average filters

k

k 0=

L 1–

1 L–1 –--------------- , 1

L, 1 (why?)=

=

ej–

=

H ej 1

L--- 1 e

jL––

1 ej–

–----------------------

=

1L---ejL 2–

ejL 2

ej– L 2

ej 2–

ej 2

ej– 2

– ----------------------------------------------------------------

=

L 2 sinL 2 sin--------------------------- e j L 1– 2–

=

ej L 1– 2– L 2 sinL 2 sin

DL ej diric L L 2 sin

L 2 sin---------------------------= =

ECE 2610 Signals and Systems 6–25

Page 26: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Moving Average Filtering

Plotting the Frequency Response

• The frequency response can be plotted most easily usingMATLAB’s 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)')

−3 −2 −1 0 1 2 30

0.5

1

Mag

nitu

de R

espo

nse

−3 −2 −1 0 1 2 3

−2

0

2

Pha

se R

espo

nse

(rad

)

hat(ω)

L = 10

ej4.5–

on this segment

2L

------=

5--- 2

5------ 3

5------ 4

5------

ECE 2610 Signals and Systems 6–26

Page 27: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Filtering Sampled Continuous-Time Signals

Filtering Sampled Continuous-Time Signals

• Consider the system model as shown below

• Suppose that

(6.34)

• We know that after sampling we have

(6.35)

• The key relationship to connect the continuous-time and thediscrete-time quantities is

(6.36)

• As long as the input analog frequency satisfies the samplingtheorem, i.e., or , the output of the dis-crete-time system will be

x t Xejt

= – t

x n x nTs XejnTs Xe

jn= = =

Ts 2 ffs---= =

Ts----- fs= =

f 2Ts------------

2------ fs= =

Ts f fs 2

ECE 2610 Signals and Systems 6–27

Page 28: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Filtering Sampled Continuous-Time Signals

(6.37)

• We can write in terms of the analog frequency variable via

(6.38)

• At the output of the D-to-C converter we have the recon-structed output

(6.39)

where f is the input analog sinusoid frequency (perhaps a bet-ter notation would be )

Example: Lowpass Averager

• Consider a 5-point moving average filter wrapped upbetween a C-to-D and D-to-C system

• We assume a sampling rate of 1000 Hz and an input com-posed of two sinusoids

• Find the system frequency response in terms of the analogfrequency variable f, and find the steady-state output

• We will use freqz() to obtain the frequency response>> w = -pi:pi/100:pi;>> H = freqz(ones(1,5)/5,1,w);>> subplot(211)

y n H ej Xejn=

y n Ts=

y n H ejTs Xe

jTsn=

y t H ejTs Xejt=

H ej2f fs Xe

j 2f fs t=

f0 0 0

x t 2 100 t cos 3 2 300 t cos+=

y t

ECE 2610 Signals and Systems 6–28

Page 29: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

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)')

>> 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)')

−3 −2 −1 0 1 2 30

0.5

1

Mag

nitu

de R

espo

nse

−3 −2 −1 0 1 2 3

−2

0

2

Pha

se R

espo

nse

(rad

)

hat(ω)

Magnitude and Phase Plots of H ej

ECE 2610 Signals and Systems 6–29

Page 30: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Filtering Sampled Continuous-Time Signals

• The output will be of the same form as the input ,except the sinusoids at 100 and 300 Hz need to have the filterfrequency response applied

– Note 100 Hz and 300 Hz < 1000/2 = 500 Hz (no aliasing)

• To properly apply the filter frequency response we need toconvert the analog frequencies to the corresponding discrete-time frequencies

(6.40)

−500 −400 −300 −200 −100 0 100 200 300 400 5000

0.5

1M

agni

tude

Res

pons

e

−500 −400 −300 −200 −100 0 100 200 300 400 500−4

−2

0

2

4

Pha

se R

espo

nse

(rad

)

f (Hz)

Magnitude and Phase Plots of H ej2f fs

y t x t

100Hz 2 1001000------------ 2 0.1 0.2= =

300Hz 2 3001000------------ 2 0.3 0.6= =

ECE 2610 Signals and Systems 6–30

Page 31: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Filtering Sampled Continuous-Time Signals

• The frequency response for in the general movingaverage filter is

(6.41)

• The frequency response at these two frequencies is

(6.42)

>> 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 is

(6.43)

and the D-to-C output is

(6.44)

L 5=

H ej 2.5 sin

5 2 sin---------------------------e

j2–=

H ej0.2 2.5 0.2 sin

5 0.2 2 sin---------------------------------------e

j2 0.2 –0.6472e

j0.4–= =

H ej0.6 2.5 0.6 sin

5 0.6 2 sin---------------------------------------e

j2 0.6 –0.2472e

j1.2––= =

0.2472ej0.2–

y n

y n 0.6472 0.2n 0.4– cos=

0.7416+ 0.2n 1.2– + cos

y t 0.6472 2 100 t 0.4– cos=

0.7416+ 2 300 t 0.2– cos

ECE 2610 Signals and Systems 6–31

Page 32: Frequency Response Chapter of FIR Filtersmwickert/ece2610/lecture_notes/... · Sinusoidal Response of FIR Systems ECE 2610 Signals and Systems 6–2 (6.3) where we have defined for

Filtering Sampled Continuous-Time Signals

Interpretation of Delay

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

where is a purely real function

• The pure delay system

has impulse response

and has frequency response

• We also know that the impulse response of two systems incascade is

• The L-point moving average filter thus incorporates a delayof samples

• Viewed as a cascade of subsystems

(6.45)

– If L is odd then the delay is an integer

– If L is even then the delay is an odd half integer

H ej DL e

j e j L 1– 2–=

DL ej

y n x n n0– =

h n n n0– =

H ej e

jn0–=

h n h1 n *h2 n =

H ej H1 e

j H2 ej =

L 1– 2

H ej DL e

j e j L 1– 2–=

ECE 2610 Signals and Systems 6–32