Skip to content Skip to navigation

Connexions

You are here: Home » Content » Filtering: Test Sequences

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Endorsed by Endorsed (What does "Endorsed by" mean?)

This content has been endorsed by the organizations listed. Click each link for a list of all content endorsed by the organization.
  • IEEE-SPS

    This module is included inLens: IEEE Signal Processing Society Lens
    By: IEEE Signal Processing SocietyAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Click the "IEEE-SPS" link to see all content they endorse.

  • College Open Textbooks display tagshide tags

    This module is included inLens: Community College Open Textbook Collaborative
    By: CC Open Textbook CollaborativeAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Comments:

    "Reviewer's Comments: 'I recommend this book as a "required primary textbook." This text attempts to lower the barriers for students that take courses such as Principles of Electrical Engineering, […]"

    Click the "College Open Textbooks" link to see all content they endorse.

    Click the tag icon tag icon to display tags associated with this content.

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • Bookshare

    This module is included inLens: Bookshare's Lens
    By: Bookshare - A Benetech InitiativeAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Comments:

    "Accessible versions of this collection are available at Bookshare. DAISY and BRF provided."

    Click the "Bookshare" link to see all content affiliated with them.

  • NSF Partnership display tagshide tags

    This module is included inLens: NSF Partnership in Signal Processing
    By: Sidney BurrusAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Click the "NSF Partnership" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

  • Featured Content display tagshide tags

    This module is included inLens: Connexions Featured Content
    By: ConnexionsAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Comments:

    "A First Course in Electrical and Computer Engineering provides readers with a comprehensive, introductory look at the world of electrical engineering. It was originally written by Louis Scharf […]"

    Click the "Featured Content" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • UniqU content

    This module is included inLens: UniqU's lens
    By: UniqU, LLCAs a part of collection: "A First Course in Electrical and Computer Engineering"

    Click the "UniqU content" link to see all content selected in this lens.

  • Lens for Engineering

    This module is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

Filtering: Test Sequences

Module by: Louis Scharf. E-mail the author

Note:

This module is part of the collection, A First Course in Electrical and Computer Engineering. The LaTeX source files for this collection were created using an optical character recognition technology, and because of this process there may be more errors than usual. Please contact us if you discover any errors.

When we design a filter, we design it for a purpose. For example, a moving average filter is often designed to pass relatively constant data while averaging out relatively variable data. In an effort to clarify the behavior of a filter, we typically analyze its response to a standard set of test signals. We will call the impulse, the step, and the complex exponential the standard test signals.

Unit Pulse Sequence. The unit pulse sequence is the sequence

u n = δ n = 1 , n = 0 0 , n 0 . u n = δ n = 1 , n = 0 0 , n 0 . (1)

This sequence, illustrated in Figure 1, consists of all zeros except for a single one at n=0n=0. If the unit pulse sequence is passed through a moving average filter (whether finite or not), then the output is called the unit pulse response:

h n = k = 0 w k δ n - k = w n . h n = k = 0 w k δ n - k = w n . (2)
Figure 1: Unit Pulse Sequence
This Cartesian graph is relatively simple. The positive portion of the x axis is marked with dashed dots spaced equidistant from each other. The first three are labeled 1, 2, and 3. There are three more dots to the right of those dots. The x axis is labeled n. The y axis only has one dashed point and the it is labeled 1.

(Note that δn-k=0δn-k=0 unless n=k.n=k.) So the unit pulse sequence may be used to read out the weights of a moving average filter. It is common practice to use w k w k (the kthkth weight) and h k h k (the kthkth impulse response) interchangeably.

Exercise 1

Find the unit pulse response for the finite moving average xn=k=0N-1wkun-kxn=k=0N-1wkun-k. Caution: You must consider n<0,0nN-1n<0,0nN-1, and nNnN.

Exercise 2

Find the unit pulse response for the recursive filter xn=axn-1+w0unxn=axn-1+w0un.

Unit Step Sequence. The unit step sequence is the sequence

u n = ξ n = 1 , n 0 0 , n < 0 . u n = ξ n = 1 , n 0 0 , n < 0 . (3)

This sequence is illustrated in Figure 2. When this sequence is applied to a moving average filter, the result is the unit step response

g n = k = 0 n w k = k = 0 n h k . g n = k = 0 n w k = k = 0 n h k . (4)

The unit step response is just the sequence of partial sums of the unit pulse response.

Figure 2: Unit Step Sequence
This Cartesian graph has three dashed dots on the negative portion of the x acis. The origin is labeled 0. On the poisitive side of the x axis there are four dashes. The third dash is labeled 3 and the x axis is labeled n. On the positive portion of the y-axis there is a single dashed dot labeled 1. To the right of this dashed dot there are four dots that are directly above the dashes on the positive portion of the x axis. Just above and to the right of the dots is the expression ξ_n vs n. Directly below this this symbol are three more dots. These dots are slightly above and to the right of the dashes on the x axis.

Exercise 3

Find the unit step response for the finite moving average filter xn=k=0N-1wkun-kxn=k=0N-1wkun-k. Specialize your general result to the special case where wk=1Nwk=1N for k=0,1,...,N-1k=0,1,...,N-1.

Exercise 4

Find the unit step response for the recursive filter xn=axn-1+w0unxn=axn-1+w0un.

Complex Exponential Sequence. The complex exponential sequence is the sequence

u k = e j k θ , k = 0 , ± 1 , ± 2 , ... u k = e j k θ , k = 0 , ± 1 , ± 2 , ... (5)

This sequence, illustrated in Figure 3, is a “discrete-time phasor” that “ratchets” counterclockwise (CCW) as k k moves to k+1k+1 and clockwise (CW) as k k moves to k-1k-1. Each time the phasor ratchets, it turns out an angle of θ θ. Why should such a sequence be a useful test sequence? There are two reasons.

Figure 3: Discrete-Time Phasor
This is a circle divided in to many slices. The bottom left is the size of a quarter of the circle. Above this section is a 1/8th sized portion and the rest of the circle is divided into 1/16th sized portions. The right half of the circle has mathematical expression associated with the different slices. The second slice from the top is labeled e^{j2θ} the next slice has an arch capped on either end with horizontal lines and the actual arch is labeled θ. The next few slices proceeding down are labeled e^{jθ}, then e^{j0}, then e^{-jθ}, and finally e^{-j2θ}.

(i) e j k θ e j k θ represents (or codes) coskθcoskθ. The real part of the sequence ejkθejkθ is the cosinusoidal sequence coskθcoskθ:

Re [ejkθ]=coskθ. Re [ejkθ]=coskθ.(6)

Therefore the discrete-time phasor ejkθejkθ represents (or codes) coskθcoskθ in the same way that the continuous-time phasor ejωtejωt codes cosωtcosωt. If the moving average filter

x n = k = 0 h k u n - k x n = k = 0 h k u n - k (7)

has real coefficients, we can get the response to a cosinusoidal sequence by taking the real part of the following sum:

x n = k = 0 h k cos ( n - k ) θ = Re [ k = 0 h k e j ( n - k ) θ ] = Re [ e j n θ k = 0 h k e - j k θ ] . x n = k = 0 h k cos ( n - k ) θ = Re [ k = 0 h k e j ( n - k ) θ ] = Re [ e j n θ k = 0 h k e - j k θ ] . (8)

In this formula, the sum

k=0hke-jkθk=0hke-jkθ (9)

is called the complex frequency response of the filter and is given the symbol

H(ejθ)=k=0hke-jkθ.H(ejθ)=k=0hke-jkθ. (10)

This complex frequency response is just a complex number, with a magnitude |H(ejθ)||H(ejθ)| and a phase arg H(ejθ)H(ejθ). Therefore the output of the moving average filter is

x n = Re [ e j n θ H ( e j θ ) ] = Re [ e j n θ | H ( e j θ ) | e j arg H ( e j θ ) ] = | H ( e j θ ) | c o s [ n θ + arg H ( e j θ ) ] . x n = Re [ e j n θ H ( e j θ ) ] = Re [ e j n θ | H ( e j θ ) | e j arg H ( e j θ ) ] = | H ( e j θ ) | c o s [ n θ + arg H ( e j θ ) ] . (11)

This remarkable result says that the output is also cosinusoidal, but its amplitude is |H(ejθ)||H(ejθ)| rather than 1, and its phase is argH(ejθ)argH(ejθ) rather than 0. In the examples to follow, we will show that the complex “gain” H(ejθ)H(ejθ) can be highly selective in θ θ, meaning that cosines of some angular frequencies are passed with little attenuation while cosines of other frequencies are dramatically attenuated. By choosing the filter coefficients, we can design the frequency selectivity we would like to have.

(ii) ejkθejkθ is a sampled data version of e jωt e jωt. The discrete-time phasor ejkθejkθ can be produced physically by sampling the continuous-time phasor ejωtejωt at the periodic sampling instants tk=kTtk=kT:

e j k θ = e j ω t | t = k T = e j ω k T θ = ω T . e j k θ = e j ω t | t = k T = e j ω k T θ = ω T . (12)

The dimensions of θ θ are radians, the dimensions of ω ω are radians/second, and the dimensions of T T are seconds. We call TT the sampling interval and 1T1T the sampling rate or sampling frequency. If the original angular frequency of the phasor ejωtejωt is increased to ω+m(2πT)ω+m(2πT), then the discrete-time phasor remains ejkθejkθ :

ej[ω+m(2π/T)]t|t=kT=ej(ωkT+km2π)=ejkθ.ej[ω+m(2π/T)]t|t=kT=ej(ωkT+km2π)=ejkθ. (13)

This means that all continuous-time phasors of the form ej[ω+m(2π/T)]tej[ω+m(2π/T)]t “hide under the same alias” when viewed through the sampling operation. That is, the sampled-data phasor cannot distinguish the frequency ωω from the frequency ω+m2πTω+m2πT. In your subsequent courses you will study aliasing in more detail and study the Nyquist rule for sampling:

T2πΩ;1TΩ2πT2πΩ;1TΩ2π(14)

This rule says that you must sample signals at a rate (1T)(1T) that exceeds the bandwidth Ω2πΩ2π of the signal.

Example 1

Let's pass the cosinusoidal sequence uk=uk= cos kθkθ through the finite moving average filter

x n = k = 0 N - 1 h k u n - k h k = 1 N k = 0 , 1 , ... , N - 1 . x n = k = 0 N - 1 h k u n - k h k = 1 N k = 0 , 1 , ... , N - 1 . (15)

We know from our previous result that the output is

xn=|H(ejθ)|cos[nθ+argH(ejθ)].xn=|H(ejθ)|cos[nθ+argH(ejθ)].(16)

The complex frequency response for this example is

H ( e j θ ) = k = 0 N - 1 1 N e - j k θ = 1 N 1 - e - j N θ 1 - e - j θ H ( e j θ ) = k = 0 N - 1 1 N e - j k θ = 1 N 1 - e - j N θ 1 - e - j θ (17)

(Do you see your old friend, the finite sum formula, at work?) Let's try to manipulate the result into a more elegant form:

H ( e j θ ) = 1 N e - j ( N / 2 ) θ [ e j ( N / 2 ) θ - e - j ( N / 2 ) θ ] e - j ( θ / 2 ) [ e j ( θ / 2 ) - e - j ( θ / 2 ) ] = 1 N e - j [ ( N - 1 ) / 2 ] θ sin ( N 2 θ ) sin ( 1 2 θ ) . H ( e j θ ) = 1 N e - j ( N / 2 ) θ [ e j ( N / 2 ) θ - e - j ( N / 2 ) θ ] e - j ( θ / 2 ) [ e j ( θ / 2 ) - e - j ( θ / 2 ) ] = 1 N e - j [ ( N - 1 ) / 2 ] θ sin ( N 2 θ ) sin ( 1 2 θ ) . (18)

The magnitude of the function H(ejθ)H(ejθ) is

|H(ejθ)|=1N,|sin(N2θ)sin(12θ)|.|H(ejθ)|=1N,|sin(N2θ)sin(12θ)|. (19)

At θ=0θ=0, corresponding to a “DC phasor,” H(ejθ)H(ejθ) equals 1; at θ=2πNθ=2πN|H(ejθ)=0||H(ejθ)=0|. The magnitude of the complex frequency response is plotted in Figure 4.

Figure 4: Frequency Selectivity of a Moving Average Filter
This Cartesian graph contains a series of arches progressing along the x axis. The first arch starts at the far left end of the negative portion of the x axis and returns to the x axis about halfway to the origin. This point is labeled -2π/N. The next arch begins at this same point and returns to the x axis the same distance away from the origin as it left  but now on the positive side of the x axis. This point is labeled 2π/N. At about the peak of this arch on the negative side of the x axis is the mark 1. The third arch begins at point 2π/N and ends at a point labeled 2(2π/N). There is one final arch that starts at the last point and an unlabeled point. The x axis is labeled θ.

This result shows that the moving average filter is frequency selective, passing low frequencies with gain near 1 and high frequencies with gain near 0.

Exercise 5

Compute the phase of the complex frequency response

H ( e j θ ) = 1 N e - j [ ( N - 1 ) / 2 ] θ sin ( N 2 θ ) sin ( 1 2 θ ) . H ( e j θ ) = 1 N e - j [ ( N - 1 ) / 2 ] θ sin ( N 2 θ ) sin ( 1 2 θ ) . (20)

Exercise 6

Choose the filter length N N for the filter hk=1N,k=0,1,...,N-1hk=1N,k=0,1,...,N-1, so that a 60 Hz cosine, sampled at the rate 1T=1801T=180, is perfectly zeroed out as it comes through the filter.

Exercise 7

(MATLAB) Write a MATLAB program to compute and plot the magnitude |H(ejθ)||H(ejθ)| and the phase arg H(ejθ)H(ejθ) versus -π<θ<π-π<θ<π when

H ( e j θ ) = 1 N e - j [ ( N - 1 ) / 2 ] θ sin ( N 2 θ ) sin ( 1 2 θ ) . H ( e j θ ) = 1 N e - j [ ( N - 1 ) / 2 ] θ sin ( N 2 θ ) sin ( 1 2 θ ) . (21)

Choose suitable increments for θ θ.

Exercise 8

Compute the complex frequency response H(ejθ)H(ejθ) for the recursive filter xn=axn-1+w0unxn=axn-1+w0un.

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks