42
EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Embed Size (px)

Citation preview

Page 1: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

EE513Audio Signals and Systems

Digital Signal Processing (Systems)

Kevin D. DonohueElectrical and Computer Engineering

University of Kentucky

Page 2: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Laplace to begin withThe Laplace transform is used to characterize and analyze signal and system interactions. If x(t) is the time domain signal, its Laplace transform is defined as:

where s belongs to the set of complex numbers over which the integral converges. What is the Laplace transform of a system impulse response? What does the Laplace transform become if it is evaluated along the imaginary axis?

dtsttxsX )exp()()(~

Page 3: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Z-Transform

If the Laplace transform is made discrete by sampling the time axis with interval Ts, it becomes:

Now let:

n

sss TsnTnTxsX )exp()()(~

)exp()exp()exp()exp(

)exp()exp()exp(

]IM[]RE[

)exp(

ssn

ssn

ssss

s

nTjnTTjTz

TjTTjTz

jsjss

sTz

Page 4: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Z-TransformSubstitute z to obtain:

Normalize sampling rate and define Z-transform as:

where z belongs to the set of complex numbers for which summation converges. Describe mapping from S-plane to Z-plane.

ns

ns

s

TznTxzT

X )()ln(1~

n

nznxzX )(ˆ

Page 5: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

j Axis in s to z Mappingj axis in s corresponds to a zero real part, = 0 for all imaginary values, . In z this results in:

s

s

ssss

f

ffTzz

TjTjTTjz

22T ,1

)exp()exp()0exp()exp(

s

S-planeIM

RE

ss f

f 2

2

sf2

sf

sf2

RE

Z-planeIM

1

j

1

j

Page 6: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Z-plane S-plane Relationships

Imaginary axis (j) in S-plane, maps into the unit circle in Z-plane, where segments on the j axis described by:

map into a complete unit circle for every integer k.

Since the mapping from S to Z is not unique, let the range for k=0 be referred to as the root frequency range and all other values of k with the aliased frequency ranges.

ss

sss f

Tkkk

22

and for 2

)12(2

)12( I

Page 7: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Negative Real Axis s to z MappingNegative real axis in s corresponds to < 0. In z this results in:

sT ,1)exp(

)exp()exp()exp(

zTz

TjTTjTz

s

ssss

Z-plane

RE

IM

1

j

1

j

S-plane IM

RE

sf

sf2

sf

sf2

sf3

sf3

Page 8: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Z-plane S-plane RelationshipsThe negative real axis of the S-plane ( < 0 ) maps into the area inside the unit circle of Z (| z | < 1) . Therefore the stable region of the S-plane (left-half plane) corresponds to the area inside the unit circle of the Z-plane. Similarly, the unstable region of the S-plane (right-half plane) corresponds to the area outside the unit circle of the Z-plane.

Because of aliasing from the sampling and scaling from the exponential transformation, there is no simple (linear) scaling between the Z and S planes. A warping or distortion occurs when matching domain points:

lnor )exp( ss T zTz

sTz

Warping

Possible Aliasing

Page 9: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Z-Transform One-SidedMany applications assume the input starts at t = 0 (n=0 for discrete) and no response exists before t = 0. So the Z-transform is often written as:

Examples: Find the z-transforms of x[n] = u[n] and x[n] = anu[n]; Assuming the z-transform of x[n] is X(z), find the Z-transform of x[n-k] for k>0.

0

ˆn

nznxzX

Page 10: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Homework(1)Find the z-Transforms of:

a)

b)

c)

][cos nubnnx

knununx

15.15.given

)(

)( Find

nxnxnyny

zX

zY

Use definition

for k > 0. Use definition

Use ZT properties (delay)

Page 11: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

ConvolutionGiven the impulse response of a discrete linear system h[n] the input-output relationship is described by discrete convolution:

For x[n] and h=[n] below, graphically demonstrate their convolution.

00

][][][][][*][][mm

mhmnxmnhmxnhnxny

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2x(n)

n-6 -4 -2 0 2 4 6 8 10 12 14

0

0.2

0.4

0.6

0.8

1h(n)

n

Page 12: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(-1-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = -1

n

Page 13: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(0-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 0

n

Page 14: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(1-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 1

n

Page 15: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(2-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 2

n

Page 16: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(3-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 3

n

Page 17: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(4-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 4

n

Page 18: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(5-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 5

n

Page 19: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(6-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 6

n

Page 20: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(7-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 7

n

Page 21: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(8-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 8

n

Page 22: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(9-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 9

n

Page 23: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(10-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 10

n

Page 24: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(11-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 11

n

Page 25: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(12-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 12

n

Page 26: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

-6 -4 -2 0 2 4 6 8 10 12 14-2

-1

0

1

2

m

System response h(13-m) in black X, Signal x(m) in red O

-4 -2 0 2 4 6 8 10 12-4

-2

0

2

4

Convolution output up to n = 13

n

Page 27: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Sinusoidal ResponseConsider sinusoidal input:

Note this input is always on (steady-state). Show that for impulse response h(n), the convolution sum for evaluating the output becomes:

Important Concepts: The response to a sinusoidal input is a phasor multiplication between input

phasor and transfer function value at the excitation frequency. The frequency response (Transfer Function) of a discrete system is the z-

transform of its impulse response evaluated on the unit circle! Convolution in time domain is equivalent to multiplication in the frequency

domain.

)exp(][ 0njAnx

)exp(

00

)(ˆexp][][][

jzm

zHnjAmhmnxny

Input

Complex Coefficient

Page 28: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Sinusoidal Response Example

For sinusoidal input:

And system described by:

Derive an expression for and plot the frequency response (phase and magnitude) of the system output.

4exp][

njAnx

]1[5.][][ nynxny

Page 29: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Homework(2)For sinusoidal inputs:

And system described by:

Plot the frequency response (phase and magnitude) and compute the corresponding outputs.

njnxb exp5][ )

]2[25.]1[5.]1[][ nynynxny

4][ ) nxd

3

2exp][ )

njnxc

2exp5.0][ )

njnxa

)2216.0cos(3][ ) nnxe

Page 30: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

SamplingSampling rate determines the highest signal frequency that can be reconstructed from the signal samples without error. At least 3 samples (2 complete sampling intervals) must fall within a period for digitization without aliasing. In other words the sampling rate must be greater than twice the highest signal frequency for a band limited signal.

0 0.02 0.04 0.06 0.08 0.1

-1

-0.5

0

0.5

1

Seconds

Am

plit

ud

eRed: 180 Hz, Blue Aliased to: 20 Hz

Fs =200 HzTs = 5 ms

Page 31: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

SamplingAliasing I – The Movie (FS=200, Range 50-150 Hz) Run following mfile at: http://www.engr.uky.edu/~donohue/ee513/mfiles/aliasexm.m

Page 32: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

SamplingAliasing II – The Sequel (FS=200, Range 350-450 Hz). Change beginning and ending frequency parameters in following mfile to run: http://www.engr.uky.edu/~donohue/ee513/mfiles/aliasexm.m

Page 33: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

The Sampling Theorem

A band-limited continuous signal s(t) can be reconstructed without error from its samples provided:

where fs is the sampling frequency in samples per second, and fb is the frequency above which s(t) has no energy.

bs ff 2

Page 34: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Aliased Signal Spectra

Sampling in time with sampling frequency fs creates an infinite pattern of a shifted analog spectra so that frequency domain has a periodicity of fs. Let Sa(f) be the spectra of the original analog signal, the spectrum of the sampled signal becomes:

n

sasd nffSffS )()(

Page 35: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Aliased Signal SpectraSpectral periodicity of a low-pass signal (not really band-limited) resulting from an 8 kHz sampling

-20 -15 -10 -5 0 5 10 15 200

0.005

0.01

0.015

0.02

0.025

kHz

Am

plit

ud

e

Spectrum of Discrete Signal for Sampling Rate 8 kHz

fs

2fs

0.5fs

FoldingFrequency

-20 -15 -10 -5 0 5 10 15 200

0.05

0.1

0.15

0.2

kHz

Am

plitu

de

Original Analog Spectrum

Page 36: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Restoring Sampled SignalsA sampled signal is reconstructed by low-pass filtering the samples with a cut-off near the folding frequency

-20 -15 -10 -5 0 5 10 15 200

0.005

0.01

0.015

0.02

0.025

kHz

Am

plit

ud

e

Spectrum of Discrete Signal for Sampling Rate 8 kHz

Page 37: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Aliased Signal ExampleBefore sampling at a given rate, signals are often low-pass filtered (anti-aliasing filter) to limit distortions from aliasing.

Original Sound

Limited Bandwidth (LPF with 900 Hz cutoff) and sampled at 2 kHz

Original Sound sampled at 2 kHz (aliasing)

102

103

104

-120

-100

-80

-60

-40

-20

Hertz

dB

Tell Me Ma - Average Spectrum CD quality

101

102

103

104

105

-150

-100

-50

0Tell Me Ma - Average Spectrum 900 Hz cutoff

Hertz

dB

Page 38: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Homework(3)Determine the aliased frequencies in the range of

For the following sampling frequency and signal pairs:

22ss f

ff

))250002(exp()( kHz 4 )

))500002cos(()( kHz 8 )

))100002cos(()( kHz 025.11 )

))80002cos(()( kHz 8 )

))320002cos(()( kHz 1.44 )

tj t sfe

t t sfd

t t sfc

t t sfb

t t sfa

s

s

s

s

s

Page 39: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Linear Difference EquationsDiscrete systems are described by Z-transforms in the frequency domain and difference equations in the time domain. Digital filters can be designed in either domain.Find the impulse response of the following filters.

(FIR)

(IIR)

a) Compute impulse response directly by handb) Use Matlab function “filter”c) Take inverse of Z transformd) Examine poles and zeros of filters

]2[08.]1[4.][][ nynynxny

]4[]2[2][][ nxnxnxny

Page 40: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Linear Difference Equations]4[]2[2][][ nxnxnxny(FIR)

Input x[n] x[n-1] x[n-2] x[n-3] x[n-4] y{n]Coeff: 1 0 -2 0 1n=-4 0 0n=-3 0 0 0n=-2 0 0 0 0n=-1 0 0 0 0 0n=0 1 1 0 0 0 0 1n=1 0 0 1 0 0 0 0n=2 0 0 0 1 0 0 -2n=3 0 0 0 0 1 0 0n=4 0 0 0 0 0 1 1n=5 0 0 0 0 0 0 0n=6 0 0 0 0 0 0 0

Page 41: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Linear Difference Equations(IIR)

Input x[n] y[n-2] y[n-1] y{n]Coeff: 1 -0.08 -0.4n=-2 0n=-1 0n=0 1 1 0 0 1n=1 0 0 0 1 -0.4n=2 0 0 1 -0.4 0.08n=3 0 0 -0.4 0.08 0n=4 0 0 0.08 0 -0.0064n=5 0 0 0 -0.0064 0.00256n=6 0 0 -0.0064 0.00256 -0.00051n=7 0 0 0.00256 -0.00051 0n=8 0 0 -0.00051 0 4.1E-05n=9 0 0 0 4.1E-05 -1.6E-05

]1[4.]2[08.][][ nynynxny

Page 42: EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky

Homework (4)

Find the impulse response of the following filters.a)b)c)

1) Use Matlab function “filter”2) Take inverse of Z transform3) Examine poles of filter and comment on expected

stability

)2(5.)1()(2)( nynynxny

)1()()( nxnxny

)2(8)1(4)(5.)( nynynxny