40
Basics of Signal Processing

Basics of Signal Processing. frequency = 1/T speed of sound × T, where T is a period sine wave period (frequency) amplitude phase

Embed Size (px)

Citation preview

Basics of Signal Processing

frequency = 1/T

speed of sound × T, where T is a period

sine wave •period (frequency)•amplitude•phase

f (t) = Asin(2πt /T + φ)

f (t) = Asin(ωt + φ)

Asin(ωt + π /2)

= Acos(ωt)

sine cosinePhase

Sinusoidal grating of image

• Fourier idea– describe the

signal by a sum of other well defined signals

TO

Fourier Series

A periodic function as an infinite weighted sum of simpler periodic functions!

f (t) = wi

i= 0

∑ f i(t)

A good simple function

Ti=T0 / i

f i(t ) = sin(iω 0t + φ),

where ω 0 = 2π / T0

f (t) = ki sin(iω0

i=1

∑ + ϕ n )

= [bi

i=1

∑ sin(iω0) + ai cos(iω0)]

= Re ˆ c i ⋅e− jω0n

i= 0

∑ , ˆ c − complex

e.t.c. ad infinitum

f (t) = ki sin(iω0

i=1

∑ + ϕ n ) = [bi

i=1

∑ sin(iω0) + ai cos(iω0)]

T=1/f

e.t.c……

T=1/f

e.t.c……

Fourier’s Idea

Describe complicated function as a weighted sum of simpler functions!-simpler functions are known-weights can be found

Simpler functions - sines and cosines are orthogonal on period T, i.e.

f(mt)⋅ f(nt) 0

T

∫ dt = 0 for m ≠ n

period T period T

Orthogonality

sinnωt ⋅cosmωtdt = 00

T

cosnωt ⋅cosmωtdt = 0 for n ≠ m and T2

0

T

∫ for n = m

sinnωt ⋅sin mωtdt = 0 for n ≠ m and T2

0

T

∫ for n = m

0+

-

0+

-

0+

-

x

0 + +--

x

0

+ +

=

0 + +- -

=

area is positive (T/2) area is zero

f(t) = 1.5 + 3sin(2πt/T) + 4sin(4πt/T)

= + +0 T

1

Tf(t)dt

0

T

∫ =1.50 T

1.5

b1 =2

Tf

0

T

∫ (t)sin(2πt

T)dt = 3 = + +0 T

0 3 0

One example of a function

=

f(t) = DC + a i cos(2πit

T) + b1 sin(

2πit

T)

⎡ ⎣ ⎢

⎤ ⎦ ⎥=

i=1

∑ DC + a1 cos(2πt

T) + b1 sin(

2πt

T) + a2 cos(

4πt

T) + b2 sin(

4πt

T) + a3 cos(

6πt

T) + b3 sin(

6πt

T) + .........

f(t)sin(2πt

T)dt

0

T

∫ = {DC0

T

∫ sin(2πt

T) + a1 cos(

2πt

T)sin(

2πt

T) + b1 sin(

2πt

T)sin(

2πt

T) + a2 cos(

4πt

T)sin(

2πt

T) + b2 sin(

4πt

T)sin(

2πt

T) + .........}dt

0 0 b1T/2 0 0 ……………

area=b1T/2

area=b2T/2

f(t) = DC + f1(t) + f2(t) = DC + b1 • sinωt + b2 • sin2ωt

sin2

0

T

∫ (t

T) dt =

T

2

T=2

+

-+ +

+ + + +

+ + + +

+ +- -

- - - -

f(t) f(t) sin(2πt) f(t) sin(4πt)

area = DC area = b1T/2 area = b2T/2

Spacing of spectral components is 1/T

Periodicity in one domain (here time) implies discrete representation in the dual domain (here frequency)

0 1/T 2/Tfrequency

0 1/T 2/Tfrequency

Phase spectrumMagnitude spectrum

Aperiodic signal

T0 →∞ ⇒ frequency spacing f0 → 0

Discrete spectrum becomes continuous (Fourier integral)

0 1/T0 2/T0frequency0 1/T0 2/T0frequency

Phase spectrumMagnitude spectrum

Spacing of spectral components is f0 =1/T0

Magnitude spectrum of voiced speech signal

frequency

log | S() |

F1

F2 F3

F4

f0

1/f0

1/F11/F2

Waveform

Logarithmic power spectrum

f0

F1

F2 F3

Going digital

sampling

22 samples per 4.2 ms 0.19 ms per sample 5.26 kHz

ts=1/fs

Sampling

> 2 samples per period,fs > 2 f

T = 10 ms (f = 1/T=100 Hz)

Sinusoid is characterized by three parameters1.Amplitude2.Frequency3.Phase

We need at least three samples per the period

T = 10 ms (f = 1/T=100 Hz)

ts = 7.5 ms (fs=133 Hz < 2f )

Undersampling

T’ = 40 ms(f’= 25 Hz)

Sampling at the Nyquist frequency

2 samples per period,fs = 2 f

Nyquist rate

ts = 5 ms (fs=200 Hz)

?

??

fs > 2 f

Sampling of more complex signals

period period

highest frequencycomponent

Sampling must be at the frequency which is higher than the twice the highest frequency component in the signal !!!

fs > 2 fmax

Sampling

1. Make sure you know what is the highest frequency in the signal spectrum fMAX

2. Chose sampling frequency fs > 2 fMAX

NO NEED TO SAMPLE ANY FASTER !

Periodicity in one domain implies discrete representation in the dual domain

0 1/T 2/Tfrequency

Magnitude spectrumT

frequency

F =1/ts

fs = 1/T

time

ts

T

Sampling in time implies periodicity in frequency !

1

0

21 )()(

N

n

N

knj

N ekXnx

1

0

21 )()(

N

n

N

knj

N enxkX

Discrete and periodic in both domains (time and frequency)

DISCRETE FOURIER TRANSFORM

Recovery of analog signalDigital-to-analog converter (“sample-and-hold”)

Low-pass filtering

0.0000000000000000.3090167420035500.5877848229325430.8090165264524070.9510561882928811.0000000000000000.9510570082965530.8090180861922140.5877869697305400.3090192657165440.000000000000000-0.309014218288380-0.587782676130406-0.809014966706903-0.951055368282511-1.000000000000000-0.951057828293529-0.809019645926324-0.587789116524398-0.309021789427363-0.000000000000000

Quantization

11 levels

21 levels

111 levels

a part of vowel /a/

16 levels (4 bits) 32 levels (5 bits) 4096 levels (12 bits)

Quantization

• Quantization error = difference between the real value of the analog signal at sampling instants and the value we preserve

• Less error less “quantization distortion”

Homework 2

• Create for your fun (and education) various periodic functions using Fourier principle (and listen to the created signals)

Homework 3

• What happens if the signal is not periodic and why?

Homework 4

• How would you transmit the signal below and why?

t0 t0

Homework 5

• A signal generator produced a triangular wave which was sampled as indicated below. Was the signal samples correctly? If not, what went wrong and how would you fix it?

time