Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect...

124
2.1 MODULE 2: Frequency domain representation and sampling in the iPhone Motivation Signal spectrum Sampling Undersampling, oversampling, critical sampling and aliasing Sampling theorem Perfect reconstruction credit: xkcd

Transcript of Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect...

Page 1: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.1

MODULE 2: Frequency domain representation and sampling in

the iPhone

Motivation

Signal spectrum

Sampling

Undersampling, oversampling, critical sampling and aliasing

Sampling theorem

Perfect reconstruction

credit: xkcd

Page 2: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.2

Information in the real world is analog. To store them on an iPhone, we sample the signal:

When stored, we only have the samples:

Page 3: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.3

Can we recover the original signal? There are many analog signals (an infinite number,

actually) that fit these samples:

Page 4: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.4

The Frequency Domain

Motivation

The frequency domain is the key to:

o Determining how many samples the iPhone needs to take of a sound or an image or a

video.

o Being able to perfectly represent and reconstruct a signal (voice, music, image,

video)

o Being able to compress signals.

Ex. 64 GB iPhone; let’s say 10 GB are for music.

Without compression (CD quality), you could fit 185 songs on your iPhone.

That’s maybe your collection of songs by _________.

With compression (mp3), you could fit about 2500 songs. About 166 hours of

playing time to shuffle the full iPhone.

o Being able to communicate with the iPhone. That’s MODULE 5…

Page 5: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.5

We generally think of a signal as a function of time f(t) in audio, or a function of space

I(x,y) in an image.

Another way to describe a signal is by the frequency content.

Basic idea: A signal can be represented by a set of sinusoids (e.g., a set of cosine

functions).

A sinusoid of a given frequency can be taller or shorter (magnitude) or shifted left or right

(phase).

The description of a signal by frequency content is quite indispensable.

Sinusoids

Model: 𝐴 𝑐𝑜𝑠 (2𝜋𝑓𝑡 + 𝜙)

𝐴: amplitude

Page 6: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.6

𝑓: frequency in Hertz – cycles per second = 1/𝑇 = 1/Period

2𝜋𝑓: radial frequency in radians per second

𝜙: phase in radians (offset from origin)

cos (𝜔𝑡 −𝜋

2) = sin(𝜔𝑡)

Ex: 1.0 cos(2𝜋440𝑡) frequency = 440Hz = ‘A’

Listen to it (*pureA.wav)

Page 7: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.7

We’re actually used to thinking of some signals this way

o Music: A = 440 Hertz (what does this mean?)

o Light: EM Waves at different frequencies – ROYGBIV. White = sum

We can model these waves using sinusoids.

o Graphic Equalizer: selectively boost or attenuate sounds within a certain frequency

range (e.g., iTunes)

o Radio tuning: select a station at a particular frequency

Page 8: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.8

Frequency domain is important from both physical and mathematical points of view:

The physical world reacts to different frequencies differently.

Our senses respond differently to different frequencies:

Eyes: different cones responding to different colors

Page 9: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.9

Ears: “Hair” cells respond to different frequencies:

This is not limited to our senses but all Linear Time-Invariant (LTI) systems (more on

this later).

Mathematically the frequency domain allows us to formulate certain problems in a much

simpler way, for example sampling and perfect reconstruction.

Page 10: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.10

Back to the spectrum

Plot of amplitude (magnitude) vs. frequency

o The spectrum of 1.0cos(2440t) is simpler than it’s amplitude

(Note: in this class, we will deal only with the magnitude spectrum. There is also a ‘phase

spectrum’, just as every sinusoid has both a magnitude and a phase. More in Fun III

(ECE)…)

Page 11: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.11

Time Domain: x(t) = A cos(2π440t)

Frequency Domain: X(f) = A δ(f – 440)

o δ(f) is a spike – more formally, a delta function

o Job security term: Dirac delta function

Aside: What are the properties of this delta function?

– δ(t) = 0 for t ≠ 0

– δ(0)is undefined but δ(t) has unit area

∫ 𝛿(𝑡)𝑑𝑡 = 1∞

−∞

Bottom line:

o Spectrum for cos(2𝜋𝑓0𝑡) consists of a spike at 𝑓0

o Spectrum for sin(2𝜋𝑓0𝑡) is similar; it also consists of a spike at 𝑓0

Page 12: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.12

More about the delta function (Optional)

𝛿(𝑡) = lim𝜖→0

𝑃𝜖(𝑡)

P(t)

t

휀 = 1 휀 = 1/2 휀 = 1/4

Page 13: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.13

What happens if multiply the delta function by another function? Let’s see that with 𝑃𝜀.

What is the area under the curve, if 휀 is very small?

∫ 𝑔(𝑡)𝛿(𝑡)𝑑𝑡 = 𝑔(0)∞

−∞

∫ 𝑔(𝑡)𝛿(𝑡 − 𝑡0)𝑑𝑡 = 𝑔(𝑡0)∞

−∞

The spectrum for cos(2𝜋𝑓0𝑡), if it extends from −∞ to +∞, is 𝛿(𝑓 − 𝑓0)

o In the examples that we will see, the time span is limited to the spectrum is an

approximation of the delta function

𝑔(𝑡)

𝑔(0)

𝑃𝜀(𝑡) 𝑃𝜀(𝑡)𝑔(𝑡)

𝑔(0)/(2휀)

1/(2휀)

Page 14: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.14

Let’s look at a slightly more complicated signal than the last example… two tones that your

iPhone can play simultaneously…

1

2(cos(2𝜋440𝑡) + cos (2𝜋554.4𝑡))

(Listen: *pureAthird.wav)

Page 15: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.15

1

3(cos(2𝜋440𝑡) + cos(2𝜋554.4𝑡) + cos (2𝜋659.3𝑡))

Listen: *pureAtriad.wav; three tones for your iPhone

Page 16: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.16

1

4(cos(2𝜋440𝑡) + cos(2𝜋554.4𝑡) + cos(2𝜋659.3𝑡) + cos(2𝜋880𝑡))

Listen: *pureAchord.wav

Page 17: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.17

21/12 = 1.0595

Virtuoso app on iPhone:

440 Hz 880 Hz

A B C D E F G A B C D E F G A

1760 Hz

one octavefrequency doubles

one semitonefrequency increases by 2 1/12

each octave has12 semitones

Page 18: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.18

Listen to the A chord: *pureAchord.wav (synthetic)

*pianoA.wav (keyboard)

440 Hz

A C# E A

440 x 24/12 = 554.4 Hz

12 semitones = 1 octave

7 semitones = “perfect fifth”

4 semitones = “major third”

440 x 212/12 = 880 Hz

440 x 27/12 =659.3 Hz

Page 19: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.19

Sounds better. What’s the difference with the pure A (computerized)?

Piano A

Page 20: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.20

Musical instruments (such as the piano) do not generate pure sinusoids, but contain

harmonics.

Page 21: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.21

Harmonics

Take A, for example:

o A = 440 Hz = fundamental frequency

o 880 Hz = 2f = Second Harmonic (note typical faux pas)

o 1320 Hz = 3f = Third Harmonic

o etc.

Job security (also way to embarrass a colleague): first “overtone” is the second harmonic.

Bottom line: the spectral description (the spectrum) is much simpler than the time domain

representation.

The spectrum is also more informative, more descriptive in this case.

Ex: *trumpetA.wav… How would you describe this sound? (compared to piano, for

example)… Let’s look at the spectrum

Page 22: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.22

What’s odd about this spectrum?

Trumpet A

Page 23: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.23

Same fundamental frequency (look at basic period of repetition), but different appearance in

time domain… how would you describe it?

Piano

Trumpet

Page 24: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.24

Let’s consider two notes (A, C#) = major third (*pianoAthird.wav)

Piano A + C#

Page 25: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.25

*trumpetAthird.wav (same frequencies, different amplitudes)

Trumpet A + C#

Page 26: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.26

One observation from the previous examples: adding an A and a C# did not produce

any “new” frequencies, just A, C# and harmonics. This is a consequence of the linearity

– that we can analyze the frequency components separately – the spectrum is the sum of

the spectra from each component.

Mathematically,

o if 𝑋(𝑓) is the spectrum of 𝑥(𝑡)

o and 𝑌(𝑓) is the spectrum of 𝑦(𝑡),

o then 𝑋(𝑓) + 𝑌(𝑓) is the spectrum of 𝑥(𝑡) + 𝑦(𝑡).

Let’s look at some more complicated spectra. *mandolin

Page 27: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.27

Spectrum is more complicated. Why?

We can say in general that

Mandolin

Page 28: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.28

o Purely periodic signals have discrete spectra (consisting of delta functions at different

frequencies)

o Non-periodic signals have continuous spectra

Page 29: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.29

Quantization errors and frequency domain

Listen to guitar_bass and guitar_bass2

Page 30: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.30

Stated differently: Every signal (video, audio, picture, etc.) has a frequency domain

representation that is unique and contains all the information of the original signal. The way

one computes the frequency domain representation from a given signal is called the Fourier

transform…

(Note: I call these tenets “Science of Information” tenets, as they extend far beyond the

iPhone.)

Science of Information Fundamental Tenet I:

There is a one-to-one relationship between a signal and its

frequency domain representation.

LOSSY IMAGE CODING

• We will review a few of popular (among many) approaches.

- (1) Vector Quantization Coding

- (2) Discrete Cosine Transform (DCT) Coding and JPEG

- (3) Wavelet-Based Image Coding

The compression ratios obtained over the first 20 years of

research:

• Things have changed!

Block Coding of Images

• Most image coding methods, including the JPEG standard,

involve breaking the image into sub-blocks to be

Page 31: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.31

Brief Discussion of Fourier Representation

Consider 𝑥(𝑡) = 𝐴1 cos(2𝜋𝑓1𝑡) + 𝐴2 cos(2𝜋𝑓2𝑡) + 𝐴3 cos(2𝜋𝑓3𝑡) + ⋯

Periodic signals can be written as sum of sinusoids.

We call this a Fourier series representation. The A’s are the Fourier coefficients.

This matches well to the discrete spectrum we discussed.

Periodic and non-periodic signals can be written as an integral of sinusoids

𝑥(𝑡) = ∫ 𝑋(𝑓) cos(2𝜋𝑓𝑡)𝑑𝑓∞

0

(More precisely 𝑥(𝑡) = ∫ |𝑋(𝑓)| cos(2𝜋𝑓𝑡 + ∠𝑋(𝑓))𝑑𝑓∞

0)

This is a Fourier integral representation.

This works well for the continuous spectrum we discussed.

Page 32: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.32

I don’t want to spoil your future classes on this subject (!), so we’ll avoid the math for right

now.

Just one example:

o For 𝑥(𝑡) = cos(2𝜋𝑓0𝑡), 𝑋(𝑓) = 𝛿(𝑓 − 𝑓0)

o 𝑥(𝑡) = ∫ 𝛿(𝑓 − 𝑓0)+∞

0cos(2𝜋𝑓𝑡) = cos(2𝜋𝑓0𝑡).

Bottom line: there is a direct relationship between 𝑥(𝑡) and 𝑋(𝑓), the signal and its

spectrum… this is the Fourier Transform.

Spectral analysis is very useful.

o EX: we can’t hear above 20KHz. So stereo doesn’t need to reproduce sound over this

limit.

o Speech is limited to 3-4 KHz. So the telephone doesn’t carry components above 4

KHz.

The iPhone needs the spectral representation to communicate (more on this later).

The iPhone needs the spectral representation to compress and store signals.

Page 33: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.33

Recall the Mandolin spectrum, most of the components were < 1KHz. Listen to

*soprano.wav.

Note: The above graph (in purple) shows the magnitude spectrum, which tells how much

of each sinusoid is in the signal. There is also the phase spectrum, which tells how much

Soprano

Page 34: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.34

each sinusoid is shifted in the signal (effectively, where the sinusoid starts). We will

concentrate on magnitude, but phase is a critical component of the frequency domain.

Page 35: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.35

Question: what would happen if we doubled the speed of playback?

*sopranodoubletime.wav

The peak at 900 Hz is now at 1800Hz

If 𝑋(𝑓) is the spectrum of 𝑥(𝑡), then the spectrum of 𝑥(2𝑡) is 𝑋(𝑓/2).

Soprano - speed doubled

Page 36: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.36

Conclusion: changing the speed of a musical recording changes pitch. To change speed

without altering pitch is not straightforward!

*voice spinner in chrome music lab

Page 37: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.37

Listen to this baritone (*terfel1.wav)

How does the spectrum compare to that of the soprano?

Baritone

Page 38: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.38

Listen to *carminaburana.wav

Combination of musical instruments and voice produces rich spectrum.

Carmina Burana

Page 39: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.39

Let’s listen to *berlioz.wav

Although complicated, there are distinct peaks.

Can we determine the key from the spectrum?

Berlioz

Page 40: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.40

Major triad: B♭, D, F (B♭is 440 x 21/12), Other peaks: notes in Bb major scale (C,

E♭, G, A)

Bb D F

Bb D F

Page 41: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.41

* spectrogram in chrome music lab

How does Shazam or SoundHound work on your iPhone?

Shazam (for example) makes a spectral fingerprint of each song.

It compares your recording to a set of fingerprints and then attempts to match.

The fingerprints are derived from the spectrum.

But this spectrum is changing in time; so Shazam uses the spectrogram – a graph of

spectral plots through time.

Page 42: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.42

Consider two sinusoids: x1(t) = cos(2π2093t) = C, x2(t) = cos(2π3520t) = A

octave up

Listen to them (sampled at 44100 hertz) *sig3a_44100.wav, sig3b_44100.wav

Page 43: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.43

𝑥𝑠𝑢𝑚(𝑡) = x1(t) + x2(t) = cos(2π2093t) + cos(2π3520t)

The spectrum is just the sum of the spectra. Superposition.

Listen to *sig3c_44100.wav

Page 44: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.44

𝑥𝑝𝑟𝑜𝑑𝑢𝑐𝑡(𝑡) = x1(t)x2(t) = cos(2π2093t) cos(2π3520t)

Multiplication: listen to *sig3d_44100.wav – not original tones!

Page 45: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.45

Look at spectrum – two components, but not at original frequencies (2093, 3520)

Page 46: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.46

Explanation

Trig identity: cos(𝑎) cos(𝑏) =1

2(cos(𝑎 + 𝑏) + cos(𝑎 − 𝑏))

So, multiplication of two cosines produces sum and difference frequencies.

In the example we just looked at 𝑓1 + 𝑓2 = 2093 + 3520 = 5613 𝐻𝑧, 𝑓1 − 𝑓2 = 1427 𝐻𝑧

𝑥𝑝𝑟𝑜𝑑𝑢𝑐𝑡(𝑡) = 𝑥1(𝑡)𝑥2(𝑡) = cos(2π2093t) cos(2π3520t)

=1

2(cos(2𝜋(3520 − 2093)𝑡) + cos(2𝜋(3520 + 2093)𝑡))

=1

2(cos(2𝜋1427𝑡) + cos(2𝜋5613𝑡))

Is this what we’re hearing? Let’s check

o *sig3e_44100 is the 1427 Hz tone

o *sig3f_44100 is the 5613 Hz tone

Page 47: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.47

Spectra of 1427 and 5613 Hz tones:

Page 48: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.48

How does this sum and the product compare?

Hmmmm…. They look pretty similar

Page 49: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.49

Negative frequencies

In the last example, we could have subtracted 3520 from 2093 to get a frequency of -1427

Hz … and this would have been OK

Remember cos(𝑎) = cos (−𝑎) – it’s an even function

o Therefore, cos(2𝜋𝑓𝑡) = cos(−2𝜋𝑓𝑡)

The spectrum has a negative side, which is the mirror image of the positive side, so we

normally do not show it.

Multiplying by the cosine, again

Page 50: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.50

What happens if we multiply the signal by cos(2𝜋𝑓1𝑡) ?

Remember if we multiplied another cosine with frequency 𝑓0 by the above cosine,

we would see frequencies of 𝑓0 − 𝑓1 and 𝑓0 + 𝑓1.

In general, we get two copies, one shifted by 𝑓1 to the right, and one shifted by 𝑓1 to

the left

Full spectrum of signal multiplied by cos(2𝜋𝑓1𝑡)

𝑓0 −𝑓0

Positive spectrum Full spectrum

Page 51: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.51

Linear Time Invariant Systems and Filtering

A system is any process that given an input signal produces an output signal (almost

anything):

A microphone: input: sound waves, output: voltage

A speaker: input: voltage, output: sound waves

A car: input: pressure on gas pedal, output: position

A linear time-invariant system:

1. responds to a signals linearly:

𝑥(𝑡) → 𝑦(𝑡), 2𝑥(𝑡) → 2𝑦(𝑡)

EX: Car goes twice as fast if you push the gas pedal twice as much

2. is time-invariant: if we shift the input in time, the output is also shifted by the same

amount

EX: tapping on the desk creates the same sound today and tomorrow.

The iPhone’s mic and speaker are LTI systems.

Page 52: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.52

The response of LTI systems to a sinusoid is multiplication by a factor that depends on

the frequency of the sinusoid:

𝑥(𝑡) = 𝐴 cos(2𝜋𝑓𝑡) → 𝑦(𝑡) = 𝐻(𝑓)𝐴 cos(2𝜋𝑓𝑡 + 𝜙)

𝐻(𝑓) > 1: amplification

𝐻(𝑓) < 1: attenuation

EX:

Response of an LTI system to a sinusoid; signal is amplified

Input Output

Page 53: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.53

EX: Response of an LTI system to a sinusoid; signal is attenuated

Input Output

Page 54: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.54

Response of an LTI system to a non-sinusoid; the shape of the signal changes

Page 55: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.55

When the input is a sinusoid, it may be amplified or attenuated, depending on its frequency.

This is determined by the spectral response of the system.

Source: FaberAcoustical

Spectral response of Microphone from Three iPhones

Page 56: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.56

Filtering

When the signal spectrum consists of different frequencies, each frequency is treated

differently by the system (may be attenuated or amplified).

A filter is a system designed to manipulate the frequency components of a signal.

Low pass filter: A filter that allows

low frequencies to go through but

eliminates high frequencies

High pass filter: A filter that allows

high frequencies to go through but

eliminates low frequencies

Page 57: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.57

Consider:

𝑥(𝑡) =1

3(cos(2𝜋250𝑡) + cos(2𝜋500𝑡) + cos (2𝜋1000𝑡))

* Listen to FLT_threetones.wav

Page 58: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.58

Low pass filter

Page 59: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.59

Low pass filter

Page 60: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.60

High pass filter

Page 61: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.61

5 Hz Sawtooth Signal

2 5t floor 5t( )– y(t)

Y(f)

FFT

Page 62: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.62

Reconstruction of time-domain signal from frequency spectrum

Y(f)

y(t)

IFFT

Page 63: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.63

Band limiting a signal (passing through a low pass filter):

2

n------ 2n5t

2---+

cos

n 1=

10

1+

n = 1 fundamental frequency

n = 10 10th harmonic

n = 0 dc term

Page 64: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.64

Reconstruction of time-domain signal from frequency spectrum

Y(f)

y(t)

IFFT

Page 65: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.65

Toward the Sampling Theorem

How does one get a digital signal inside the iPhone from an audio signal (e.g., from the

microphone)?

Answer: Analog-to-Digital

conversion

In the iPhone, this is integrated in

the microphone:

Source: iFixit

Knowles S1950 microphone in iPhone 4

Page 66: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.66

The iPhone uses a mixed signal (analog and digital) ASIC (application specific integrated

circuit) to do A-to-D conversion… inside the microphone!

Recall: Sampling is the process of taking values of the signal at discrete points.

The above microphone in the iPhone uses discrete-time sampling.

The digital camera in the iPhone utilizes discrete-space sampling.

Another question: how often does the iPhone camera unit need to sample?

o To make a perfect digital replica.

o To minimize the number of samples.

Source: ChipWorks

Knowles S1950 ASIC in iPhone 4

Page 67: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.67

A picture is sampled in pixels/cm or dots per inch (dpi)…

Higher sampling rate, better fidelity, but more pixels to store and transmit and process…

Audio Question:

Suppose we have a pure tone signal: x(t) = cos(2πft)

128 x 94 pixels 64 x 47 pixels

32 x 24 pixels 16 x 12 pixels

Page 68: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.68

The period of the cosine is 𝑇 =1

𝑓 – we often think of this period being broken up into 360

degrees or 2 radians.

For reasonable reconstruction, how many samples per period should we take?

What happens if we sample above or below this rate?

Listen to *sig28000.wav (sum of two sinusoids and 2KHz and 3.364KHz – major 6th)

Compare to *sig244100.wav – same signal, sampled much faster (>5X)

o This signal takes > 5X the storage… is it worth it?

o Moral: oversampling does not improve fidelity

Undersampling: let’s listen to *sig24000.wav

o Do you hear any new tones introduced?

o Why did this happen?

o Need to look at what is happening in the frequency domain.

Page 69: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.69

Generation of a Sampled Signal

Page 70: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.70

Signal sampled at 2048 Hz

Sampling at frequency 𝑓𝑠 can be viewed as multiplying by a sequence of spikes that are 1/𝑓𝑠

apart

Page 71: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.71

Signal sampled at 2048 Hz

Let’s increase the sampling rate to 4096 Hz, 8192 Hz, 16384 Hz

Page 72: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.72

Signal sampled at 4096 Hz

Page 73: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.73

Signal sampled at 8192 Hz

Page 74: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.74

Signal sampled at 16384 Hz

Page 75: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.75

Sampling Function

fs 27

samples/s=

Page 76: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.76

Example: Sampling a band-limited saw-tooth signal:

Sampling Process

×

=

Page 77: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.77

We know what happens in the time domain, but what about the frequency domain?

Sampled and Original Bandlimited Signal

fs 27

samples/s=

Page 78: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.78

A repeating pattern! Let’s compare with the spectrum of the non-sampled signal.

Sampled Signal and Spectrum

fs 27

samples/s=

Page 79: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.79

The spectrum is consists of shifts of the original spectrum. Where have we seen shifts of

the spectrum before?

Sampled Signal Contains Spectral Replicas

fs 27

samples/s=

128 Hz

256 Hz384 Hz

Page 80: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.80

But first, what is the effect of the sampling rate?

Spectral Replicas Occur at Multiples of fs

fs 27

samples/s=

128 Hz

Page 81: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.81

Effect of Increasing Sampling Frequency fs

fs 27

samples/s= fs 28

samples/s=

Page 82: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.82

Effect of Decreasing Sampling Frequency fs

fs 27

samples/s= fs 26

samples/s=

Page 83: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.83

Multiplying by a cosine creates a shift in the frequency domain! But what does the

sampling function have to do with cosines? They don’t look similar at all!

Cosine at fs

Cosine at 𝑓𝑠 Sampling function at 𝑓𝑠

Page 84: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.84

Cosines at fs , 2fs

Page 85: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.85

Cosines at fs , 2fs , 3fs

Page 86: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.86

Sum of Cosines at fs , 2fs , 3fs

Page 87: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.87

Normalized Sum of Cosines at f = 0, fs , 2fs ... Mfs

1

M----- 2nfst cos

n 0=

M

M 3=

Page 88: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.88

Normalized Sum of Cosines at f = 0, fs , 2fs ... Mfs

1

M----- 2nfst cos

n 0=

M

M 5=

Page 89: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.89

Normalized Sum of Cosines at f = 0, fs , 2fs ... Mfs

1

M----- 2nfst cos

n 0=

M

M 15=

Page 90: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.90

Normalized Sum of Cosines at f = 0, fs , 2fs ... Mfs

1

M----- 2nfst cos

n 0=

M

M 666=

Page 91: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.91

The sampling function is actually the sum of many cosines, at frequencies that are

multiples of 𝑓𝑠

Sampling Function and Spectrum

Page 92: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.92

So multiplying by the sampling function is the same as multiplying by those cosines

Sampling Process in the Time Domain

×

=

Page 93: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.93

In the frequency domain, the spectrum of the signal is shifted, once for each of the

cosines. (the technical term for what happens in the frequency domain is convolution)

Sampling Process in the Frequency Domain

*

=

Page 94: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.94

cos(2𝜋𝑓𝑡) × cos(2𝜋𝑓𝑠𝑡) =1

2(cos(2𝜋(𝑓 − 𝑓𝑠)𝑡) + cos(2𝜋(𝑓 + 𝑓𝑠)𝑡))

→ Multiplying by cosine shifts the spectrum by ±𝑓𝑠 (to the right and left by 𝑓𝑠)

Likewise,

Signal × cos(2𝜋𝑓𝑠𝑡) shifts all the frequencies in the signal by ±𝑓𝑠, creating

two copies of the spectrum one shifted by 𝑓𝑠 to the right and one to the left

Therefore,

Signal × sampling function shifts all the frequencies in the signal spectrum by

0, ±𝑓𝑠, ±2𝑓𝑠, ±3𝑓𝑠, …

Page 95: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.95

Reconstruction from spectra of sampled signals

27 Hz sampling rate 28 Hz sampling rate

Page 96: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.96

×

=

Page 97: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.97

Reconstruction from filtered spectrum of signal sampled at 27 Hz

Perfect reconstruction of a continuous signal from a finite number of discrete samples.

Page 98: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.98

Effect of Increasing Sampling Frequency fs

fs 27

samples/s= fs 28

samples/s=

Page 99: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.99

×

=

Page 100: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.100

Effect of Decreasing Sampling Frequency fs

fs 27

samples/s= fs 26

samples/s=

Page 101: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.101

Reconstruction from filtered spectrum of signal sampled at 28 Hz

Oversampling does not improve fidelity.

Page 102: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.102

×

=

Page 103: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.103

Reconstruction from filtered spectrum of signal sampled at 26 Hz

Imperfect reconstruction results when the sampling rate is insufficiently high.

Page 104: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.104

So, the result in the frequency domain is (an infinite number of) copies of our original

spectrum repeated every fs Hz.

0 W - W

f

Original signal with bandlimit = W

0 W - W

fs -fs f

Sampled signal, sampled at fs

Page 105: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.105

Basic principle: If you have a signal with a spectrum centered at zero frequency (=d.c., for

job security reasons), then the periodic replicas in the spectrum of the sampled signal occur

at multiples of fs.

What happens if we sample more frequently (shorter sampling period, larger sampling

frequency)?

o The replicas of the original spectrum become farther apart.

Science of Information Fundamental Tenet II:

Sampling a continuous signal at frequency fs results in a new

spectrum that contains an infinite number of copies of the

original spectrum separated by intervals of fs.

Page 106: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.106

Amazing Result: Perfect Reconstruction

Example: iPhone 7

We can represent a signal digitally with perfect fidelity!

With a finite number of samples, we can perfectly represent the analog signal!

Source: https://tinhte.vn/

The inclusion of a digital-to-analog converter, or DAC for short,

enables both the new EarPods and traditional analog headphones with

3.5mm jacks to function over the Lightning connector, which delivers digital audio.

Lightning EarPods and Lightning-to-3.5mm

headphone jack adapter reveals D-to-A converter

Page 107: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.107

Application: D to A conversion… making an analog signal out of a digital one

Page 108: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.108

Requirements for Perfect Reconstruction:

o Signal must be bandlimited (that's OK – it's natural)

o Replicas cannot overlap with original spectrum

If the frequency range of a signal is from 0 to W, the bandwidth is W.

o Example W for audio = 20 KHz

o If not bandlimited, the replicas would overlap (with each other and with original

spectrum).

Page 109: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.109

The sampling frequency (fs) and the bandwidth of the signal (W) determine the spacing

between replicas.

0 W - W

fs -fs f

Oversampled

0

fs -fs f

Undersampled (aliased)

Page 110: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.110

W -W 0 fs -fs f

Critically sampled

Rule: fs – W > W OR fs > 2W (this is the sampling theorem!)

We have to sample at a frequency that is greater than twice the bandwidth (greater

than twice the highest frequency in the signal).

2W is called the Nyquist frequency (for job security).

Science of Information Fundamental Tenet III (Sampling Theorem):

Perfect reconstruction of a bandlimited signal from a finite number of

samples is possible by sampling above the Nyquist frequency.

Page 111: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.111

AFLAC trivia question: Remember when I asked about sampling the cosine: cos (2𝜋𝑓𝑡) –

how many samples per period.

ANS: Only 2!

W=f; 2W=2f, need > 2f samples / s; there are f periods / s.

Bonus: I said 2, but the answer is actually "more than two". How could you, in

sampling a sinusoid with two samples per period, get "unlucky"???????????? (let's draw

it)

Extra bonus trivia question: in the digital world, what's the fastest signal (highest

frequency signal) you can make?

To be on the safe side, we usually sample above the Nyquist frequency.

o Because ideal LP filters aren't ideal in the real world (let's draw some).

o We call the space in between the replicas "guard bands," again for job security.

Ex: Standard audio upper limit = 20 KHz, but CD uses 44.1 KHz for sampling.

Page 112: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.112

Aliasing

When we undersample (too slow, at or below 2W samples / s), the spectra (the replicas)

overlap.

When they overlap, we try to foolishly recover the original spectrum

But our low pass filter grabs the original spectrum AND some stuff we don't want (the

overlap from adjoining replicas).

We cannot easily eliminate this false information.

It's called ALIASING.

(let's look at an example…)

1

2(cos(2𝜋5613𝑡) + cos(2𝜋1427𝑡))

Page 113: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.113

Page 114: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.114

Listen to this signal sampled at 44.1KHz (*sig3g_44100.wav); what's Nyquist?

(is 16384 above Nyquist? *sig3g_16384.wav)

What about 8192 Hz? Listen: *sig3g_8192.wav

After sampling at 8192 Hz, spectral replicas appear here

8192 Hz

8192 Hz

1427 5613-1427-5613

-5613 + 8192 = 2579 Hz

-1427 + 8192 = 6765 Hz

Page 115: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.115

Remember: 𝑊 > 𝑓𝑠 − 𝑊; 𝑓𝑠 > 2𝑊

What tones are we getting? (1427 Hz and 2579 Hz: *sig3h_8192.wav)

𝟏

𝟐(𝐜𝐨𝐬(𝟐𝝅𝟓𝟔𝟏𝟑𝒕) + 𝐜𝐨𝐬(𝟐𝝅𝟏𝟒𝟐𝟕𝒕)) sampled at 8912 Hz

Page 116: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.116

This spectrum proves our point: after undersampling, we get two sinusoids (one is false!)

Page 117: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.117

Reconstruction from 1024 Hz sampling rate

Original Signal and Spectrum

Reconstruction from 4096 Hz sampling rate

Reconstruction from 8192 Hz sampling rate

Page 118: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.118

Page 119: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.119

Page 120: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.120

Now let's look at a real signal…

Page 121: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.121

*wienerblut8192.wav

Wiener Blut, sampled at 8192 Hz

Page 122: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.122

After LPF at 1024 Hz (*wienerblut8192filtered.wav)

Wiener Blut, sampled at 8192 Hz, lowpass filtered

Page 123: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.123

Look at region below 500 Hz... what's happened? (*wienerblut2048.wav)

Wiener Blut, sampled at 2048 Hz

Page 124: Module 2: GPS - University of Virginiaffh8x/d/soi18F/Module02.pdfSampling theorem Perfect reconstruction credit: xkcd 2.2 Information in the real world is analog. To store them on

2.124

Summary

A bandlimited signal has highest frequency component at W Hz

Bandwidth is 0 to W = W

If signal is not bandlimited in the first place, we can make it bandlimited using a low pass

filter.

We have to sample the signal at 𝑓𝑠 > 2𝑊

2W is the Nyquist frequency.

Perfect Reconstruction is possible by sampling at sufficiently high rate.

Sampling below the Nyquist frequency results in aliasing. False information.

Aliasing also occurs in images and movies

*wheel12a.avi (12 samples /s ) etc. (temporal)

*spiral.avi (spatial)