Discrete-Time Signal Processing (DTSP) – v14

2 downloads 1379 Views 1MB Size Report
Mar 11, 2013 ... Discrete-Time Signal Processing (DTSP) – v14. Safety - Voltages used here are less than 15 V and normally do not present a risk of shock.
EE 392 Laboratory

5-1

Discrete-Time Signal Processing (DTSP) – v14 Safety - Voltages used here are less than 15 V and normally do not present a risk of shock.

Objective: To study impulse response and the filtering effect of networks with delay elements. To study decimation and upsampling techniques used in digital signal processing. Notes: This experiment uses continuous-time delay elements. Signals are not sampled so there is no aliasing and filter response is repetitive at intervals of f = 1/" . Equivalent sampled systems have sampling rate Fs = 1/" and input signals should not exceed Fs /2 in frequency. Outcomes: Students will observe impulse response and frequency response of delay element networks Students will experience the sounds of reverberation associated with ! lengthy delay! elements. Students will gain experience in !MATLAB audio file I/O and signal processing of .wav files. Students experience the sounds, spectra and waveforms associated with downsampling/upsampling. This includes the “rattling” sound of aliasing, and the “muffled” sound when bandwidth is reduced. Equipment: Part I uses a signal delay (Blackfin) module, summing amplifier module, an oscilloscope, and a function generator.

Procedure - Part I: (~3 hours) 1. Obtain the summing ampifier board and use the Blackfin ADSP-BF533 EZ-KIT as an external delay unit. On connection to power, the EZ-KIT will self-program and give two 4 ms delay elements and two 85 ms delay units. (Right channel delays are same as the Left).

Figure 1. Summing Amplifier Board

Revised Mar. 11, 2013

EE 392 Laboratory

5-2

Figure 2. Audio connections to the Blackfin EZ-KIT processor board

2. Use two stereo RCA audio cables to connect the both 4 ms audio delays to the summing amplifier board. Use an oscilloscope to verify the delays. 3a. Using one delay unit with build the finite impulse response (FIR) network illustrated in Fig. 3a. Use the “B’ summing amplifier as illustrated in Fig. 1. This type of feed-forward network is also called non-recursive or transversal. Set b0=b1=1. i) display and record the impulse response (suggest: 0.5 volt, 0.5 ms pulse, 20 ms period). ii) the network equation and the z-domain transfer function are given, sketch a z-plane representation of the poles and zeros. Zero will be at z = -1, where is the pole? iii) roughly sketch the theoretical transfer function magnitude noting the frequencies of zero gain and the gain at zero hertz and at frequency . iv) measure the gain vs frequency response of the network using a 100 mVrms sinusoid. Do not spend much time here – you only need a rough sketch noting the frequency of the zero and the gain at zero hertz and . The Blackfin module has a low-end cut-off at 20 Hz and this will cause a deviation from theory at low frequencies.

Figure 3. Finite impulse response (FIR) networks

3b. Using two delay units with build the finite impulse response (FIR) network illustrated in Fig. 3b. Set b0=b1=b2=1. i) display and record the impulse response (suggest: 0.5 volt, 0.5 ms pulse, 20 ms period). ii) determine the network equation and the z-domain transfer function. The z-plane representation of the poles and zeros is given. iii) roughly sketch the theoretical transfer function magnitude noting the frequencies of zero gain and the gain at zero hertz and at frequency . iv) observe the gain vs frequency response of the network using a 100 mVrms sinusoid.

EE 392 Laboratory

5-3

4a. Using one delay unit with build the infinite impulse response (IIR) network illustrated in Fig. 4a. The feed-back network is also called recursive. Use the “A” summing amplifier and select a1 = 0.5 (i.e. 20 kΩ). i) display and record the impulse response (suggest: 0.5 volt, 0.5 ms pulse, 50 ms period). ii) the network equation and the z-domain transfer function are given, sketch a z-plane representation of the poles and zeros. iii) roughly sketch the theoretical transfer function magnitude noting the frequencies of zero gain and the gain at zero hertz and at frequency . iv) observe the gain vs frequency response of the network using a 100 mVrms sinusoid.

Figure 4. Infinite impulse response (IIR) networks

4b. Using two delay units with build the infinite impulse response (IIR) network illustrated in Fig. 4b. Set a1 = +0.83 and a2 = -0.66 by setting the summing resistors to 12.0 kΩ and 15.0 kΩ and note that the negative summing input must be used. i) display and record the impulse response (suggest:0.5 volt, 0.5ms pulse, 100 ms period). ii) Determine the network equation and the z-domain transfer function. Also determine the z-plane representation of the poles and zeros. iii) roughly sketch the theoretical transfer function magnitude noting the frequencies of zero gain, maximum gain and the gain at zero hertz and at frequency . iv) observe the gain vs frequency response of the network using a 100 mVrms sinusoid.

5-4

EE 392 Laboratory Procedure - Part II: (~3 hours)

Equipment: For Part II, the preparation part will need a computer running MATLAB software. The experimental study needs all the equipment from part I. In addition, the reverberation study needs earphones and an audio file. A spectrum anaylzer is needed for one of the optional parts. 6. Prior to the laboratory period: From the course website, use the web-based downsamping and updsampling demonstration using an audio file. Do this in advance to avoid unnecessary disturbance to other students in the lab. Review MATLAB code and complete the following: a) What method is used to filter the upsampled audio file? b) What is the peak-peak amplitude reduction when the 8x file is filtered? c) What is the highest audio frequency when the 40 ks/s file is downsampled to 5 ks/s? d) Modify the MATLAB code to produce a 50-sample stem plot of a different section of data. You may substitute your own audio file (44.1 ks/s is close enough to 40 ks/s). Include the plot in your report. (use space bar to advence through program) 7. Direct Form Type II Filter – for the filter section in Fig. 5 with a1 = +0.83, a2 = -0.66 and b0=b1=b2=1, calculate and mark the poles and zeros on the z-plane plot using the method of Appendix C. Calculate the magnitude response of the filter using the method of Appendix D. (this is best done in advance). 8. Direct Form Type II Filter section – Using the summing amplifier board (Fig. 2) merge the networks illustrated in Fig. 3b and Fig. 4b to form the filter section illustrated in Fig. 5. Using a 100 mVrms sinusoid, measure the magnitude response of this filter and compare to Part 7.

Figure 5. Direct-form type II filter

.

9. Reverberation – If time permits, connect one 85 ms unit to build the recursive (feedback) network illustrated in Fig. 1 of Appendix B. Using a microphone or other audio input and an earphone for output, observe the sound of reverberation. 10. Simulink – If time permits, determine the frequency response of this delay element network using Simulink. 11. White noise – If time permits, determine the frequency response of this network by using a white noise or long sequence pseudonoise input and displaying the output spectrum (display averaging is helpful here).

EE 392 Laboratory

5-5

Appendix A – Downsampling & Upsampling In signal processing, the required memory and processing requirments can be reduced by reducing the signal’s data rate through decimation. Decimation consists of two steps, filtering and down-sampling. Down-sampling is simple. For example, to down-sample by a factor of 3, one keeps every 3rd sample and throws the rest away. The data rate is thereby reduced by a factor of 3. However there is a down-side to down-sampling; since the sampling rate is reduced by 3, the Nyquist frequency (Fs/2) is also reduced by a factor of 3. Prior to downsampling, the signal must first be filtered to remove the frequencies above the “new” Nyquist frequency retaining only signal components up to about 80% of the “new” Nyquist frequency. The finite impulse response (FIR) filter is one of several practical lowpass filters that can be used to limit the signal bandwidth.

Fig. A1 Decimator

Fig. A2 Interpolator

Once the decimated signal has passed through storage and/or signal processing, the data rate needs to be restored to the original value. Increasing the data rate is done using an interpolator. Interpolation consists of two steps: up-sampling and filtering. Up-sampling by k increases the sample rate by a factor of k. It consists of inserting k " 1 samples between every two samples of the input stream. It is common practice to first insert zeros (this is known as zero stuffing) and to calculate the intermediate values by lowpass filtering the zero-stuffed sequence. Up-sampling produces spectral images at multiples of the ! incoming data rate. A low-pass filter with a cut-off below the Nyquist frequency of the input stream is necessary to remove the unwanted images. Appendix B - Reverberation A reverberation circuit basically adds-in delayed versions of a signal to produce an echo effect. A simple reverberator is shown in Fig. B1 where the output is delayed by N samples, multiplied by a gain (that should be less than one), and added into the input signal. A problem with this simple design is that the amplitude response changes with frequency. The more sophisticated design, shown in Fig. B2, still uses a single delay but produces a flat response and is called an all-pass reverberator. For this experiment, we will consider only the simple reverberator. " = 0.66

!

Fig, B1. Simple Reverberator

Fig, B2. All-Pass Reverberator

5-6

EE 392 Laboratory

Appendix C: Z-Plane Pole Locations and Frequency of Maximum Gain As an example, consider an IIR filter with sampling rate of Fs = 500 Hz and z-domain transfer function of:

H(z) =

1 z2 = 1 " z "1 + 0.8z "2 z 2 "!z1 + 0.8

To calculate the frequency of maximum gain, solve for the pole positions and determine where they are closest to the unit circle in the z-domain.

!

For the denominator,

z=

"b ± b 2 " 4ac 1 ± 1 " 4 # 0.8 1 ± "2.2 = = = 0.5 ± j0.7416 2a 2 2

So we have two poles, z = 0.5 + j0.7416 and z = 0.5 " j0.7416 . If we convert to polar notation, the angle of the pole will be angle for maximum gain.

!

!

! 0.7416

θ  

! !

0.5

The frequency corresponding to

0.7416 = 1.483 0.5 " = tan #1 (1.483) = 0.976 radians tan(" ) =

and r =

0.5 2 + 0.7416 2 = 0.8944

radians around the unit circle would be

!

So the frequency corresponding to the pole (and maximum gain) =

Fs = 250 Hz 2

0.976 (250 Hz) = 77.7 Hz "

! Appendix D: Calculating Magnitude Response from Poles and Zeros ! As an example, consider athe direct-form type-II filter with sampling rate of Fs = 500 Hz and z-domain transfer function:

H(z) =

1+ z "1 + z "2 1 " z "1 + 0.8z "2

! We have two zeros z z = "0.5 ± j0.866 (on the unit circle) and two poles z p = 0.5 ± j0.7416 . The magnitude vs frequency ! response is calculated for values of z on the unit circle using the following complex calulation:

!

H(z) =

!

(z " zz1 )(z " zz 2 ) (z " z p1 )(z " z p 2 )

!