advertisement

EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky Laplace to begin with The 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: ~ X (s) x(t ) exp( st )dt 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? Z-Transform If the Laplace transform is made discrete by sampling the time axis with interval Ts, it becomes: ~ X ( s) x(nT ) exp( snT )T n s s s Now let: z exp( sTs ) s RE[ s] j IM[ s] j z exp( Ts jTs ) exp( Ts ) exp( jTs ) z n exp( Ts ) exp( jTs ) n exp( nTs ) exp( jnTs ) Z-Transform Substitute z to obtain: ~ 1 n X ln( z ) x(nTs ) z Ts Ts n Normalize sampling rate and define Z-transform as: Xˆ z x( n ) z n n where z belongs to the set of complex numbers for which summation converges. Describe mapping from S-plane to Zplane. j Axis in s to z Mapping j axis in s corresponds to a zero real part, = 0 for all imaginary values, . In z this results in: z exp( jTs ) exp( 0Ts ) exp( jTs ) exp( jTs ) z 1, z Ts 2fTs 2 S-plane f fs Z-plane IM IM 2f s 2 fs f s 2 j RE f s 2f s 1 1 j RE Z-plane S-plane Relationships Imaginary axis (j) in S-plane, maps into the unit circle in Zplane, where segments on the j axis described by: (2k 1) s 2 (2k 1) s 2 2 for k I and s 2f s Ts 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. Negative Real Axis s to z Mapping Negative real axis in s corresponds to < 0. In z this results in: z exp( Ts jTs ) exp( Ts ) exp( jTs ) z exp( Ts ) 1, z Ts S-plane Z-plane IM 3f s IM 2f s j f s RE f s 2f s 3f s 1 1 j RE Z-plane S-plane Relationships The 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 Zplane. 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: Warping z exp(Ts ) or z Ts Possible Aliasing ln z Ts Z-Transform One-Sided Many 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: Xˆ z xnz n n 0 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. Homework(1) Find the z-Transforms of: a) xn cosbnu[n] Use definition b) xn un un k for k > 0. Use definition c) Find Y ( z ) X ( z) given yn .5 yn 1 xn .5 xn 1 Use ZT properties (delay) Convolution Given the impulse response of a discrete linear system h[n] the input-output relationship is described by discrete convolution: m 0 m 0 y[n] x[n] * h[n] x[m]h[n m] x[n m]h[m] For x[n] and h=[n] below, graphically demonstrate their convolution. x(n) h(n) 2 1 0.8 1 0.6 0 0.4 -1 -2 -6 0.2 -4 -2 0 2 4 n 6 8 10 12 14 0 -6 -4 -2 0 2 4 n 6 8 10 12 14 Convolution output up to n = -1 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(-1-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 0 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(0-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 1 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(1-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 2 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(2-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 3 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(3-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 4 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(4-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 5 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(5-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 6 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(6-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 7 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(7-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 8 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(8-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 9 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(9-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 10 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(10-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 11 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(11-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 12 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(12-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Convolution output up to n = 13 4 2 0 -2 -4 -4 -2 0 2 4 6 8 n System response h(13-m) in black X, Signal x(m) in red O 10 12 2 1 0 -1 -2 -6 -4 -2 0 2 4 m 6 8 10 12 14 Sinusoidal Response Consider sinusoidal input: x[n] A exp( j0 n) Note this input is always on (steady-state). Show that for impulse response h(n), the convolution sum for evaluating the output becomes: y[n] x[n m]h[m] A exp j n Hˆ ( z) 0 m z exp( j0 ) Input Important Concepts: Complex Coefficient 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 ztransform of its impulse response evaluated on the unit circle! Convolution in time domain is equivalent to multiplication in the frequency domain. Sinusoidal Response Example For sinusoidal input: x[n] A exp jn 4 And system described by: y[n] x[n] .5 y[n 1] Derive an expression for and plot the frequency response (phase and magnitude) of the system output. Homework(2) For sinusoidal inputs: a) b) c) n x[n] 0.5 exp j 2 x[n] 5 exp jn j 2n x[n] exp 3 d) x[n] 4 e) x[n] 3 cos(0.2216n) And system described by: y[n] x[n 1] .5 y[n 1] .25 y[n 2] Plot the frequency response (phase and magnitude) and compute the corresponding outputs. Sampling Sampling 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. Red: 180 Hz, Blue Aliased to: 20 Hz 1 0.5 Amplitude Fs =200 Hz Ts = 5 ms 0 -0.5 -1 0 0.02 0.04 0.06 Seconds 0.08 0.1 Sampling Aliasing I – The Movie (FS=200, Range 50-150 Hz) Run following mfile at: http://www.engr.uky.edu/~donohue/ee513/mfiles/aliasexm.m Sampling Aliasing 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 The Sampling Theorem A band-limited continuous signal s(t) can be reconstructed without error from its samples provided: f s 2 fb where fs is the sampling frequency in samples per second, and fb is the frequency above which s(t) has no energy. 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: Sd ( f ) f s S n a ( f nf s ) Aliased Signal Spectra Spectral periodicity of a low-pass signal (not really bandlimited) resulting from an 8 kHz sampling Original Analog Spectrum 0.2 Amplitude 0.15 0.1 0.05 0 -20 -15 -10 -5 0 kHz 5 10 15 20 Spectrum of Discrete Signal for Sampling Rate 8 kHz 0.025 Folding Frequency Amplitude 0.02 0.015 0.01 0.5fs fs 0.005 2fs 0 -20 -15 -10 -5 0 kHz 5 10 15 20 Restoring Sampled Signals A sampled signal is reconstructed by low-pass filtering the samples with a cut-off near the folding frequency Spectrum of Discrete Signal for Sampling Rate 8 kHz 0.025 Amplitude 0.02 0.015 0.01 0.005 0 -20 -15 -10 -5 0 kHz 5 10 15 20 Aliased Signal Example Before sampling at a given rate, signals are often low-pass filtered (anti-aliasing filter) to limit distortions from aliasing. Tell Me Ma - Average Spectrum CD quality -20 Original Sound -40 dB -60 -80 Limited Bandwidth (LPF -100 with 900 Hz cutoff) and sampled at 2 kHz -120 2 3 10 4 10 Hertz 10 Tell Me Ma - Average Spectrum 900 Hz cutoff 0 Original Sound sampled at -50 dB 2 kHz (aliasing) -100 -150 1 10 2 10 3 10 Hertz 4 10 5 10 Homework(3) Determine the aliased frequencies in the range of fs fs f 2 2 For the following sampling frequency and signal pairs: a) f s 44.1 kHz s (t ) cos(( 2 32000)t ) b) f s 8 kHz s (t ) cos(( 2 8000)t ) c) f s 11.025 kHz d) f s 8 kHz s (t ) cos(( 2 50000)t ) e) f s 4 kHz s (t ) exp( j (2 25000)t ) s (t ) cos(( 2 10000)t ) Linear Difference Equations Discrete 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) y[n] x[n] 2 x[n 2] x[n 4] (IIR) y[n] x[n] .4 y[n 1] .08 y[n 2] a) b) c) d) Compute impulse response directly by hand Use Matlab function “filter” Take inverse of Z transform Examine poles and zeros of filters Linear Difference Equations (FIR) Input Coeff: n=-4 n=-3 n=-2 n=-1 n=0 n=1 n=2 n=3 n=4 n=5 n=6 y[n] x[n] 2 x[n 2] x[n 4] x[n] x[n-1] 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 x[n-2] 0 0 0 0 0 1 0 0 0 0 0 x[n-3] -2 0 0 0 0 1 0 0 0 0 x[n-4] 0 0 0 0 0 1 0 0 0 y{n] 1 0 0 0 0 1 0 0 1 0 -2 0 1 0 0 Linear Difference Equations (IIR) y[n] x[n] .08 y[n 2] .4 y[n 1] Input Coeff: n=-2 n=-1 n=0 n=1 n=2 n=3 n=4 n=5 n=6 n=7 n=8 n=9 1 0 0 0 0 0 0 0 0 0 x[n] 1 0 0 0 0 0 0 0 0 0 y[n-2] y[n-1] 1 -0.08 -0.4 0 0 1 -0.4 0.08 0 -0.0064 0.00256 -0.00051 0 0 1 -0.4 0.08 0 -0.0064 0.00256 -0.00051 0 4.1E-05 y{n] 0 0 1 -0.4 0.08 0 -0.0064 0.00256 -0.00051 0 4.1E-05 -1.6E-05 Homework (4) Find the impulse response of the following filters. a) y (n) x(n) x(n 1) b) y(n) 2 x(n) y (n 1) .5 y(n 2) c) y (n) .5 x(n) 4 y (n 1) 8 y (n 2) 1) Use Matlab function “filter” 2) Take inverse of Z transform 3) Examine poles of filter and comment on expected stability