Docsity

Midterm 2 for Microcomputer Interfacing Laboratory | EL ENG C145M, Exams of Electrical and Electronics Engineering

Toggle sidebar
bg1
Name (Last, First)
Student ID number
UNIVERSITY OF CALIFORNIA, BERKELEY
College of Engineering
Electrical Engineering and Computer Sciences Department
EECS 145M: Microcomputer Interfacing Laboratory
Spring Midterm #2 (Closed book- equation sheet provided- calculators OK)
Wednesday, April 21, 2004
PROBLEM 1 (16 points)
1a (8 points) When periodically sampling a waveform, what causes frequency aliasing and
how can it be avoided?
1b (8 points) When periodically sampling a waveform and computing its Fourier transform,
what causes spectral leakage and how can it be avoided?
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Midterm 2 for Microcomputer Interfacing Laboratory | EL ENG C145M and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

Name (Last, First) Student ID number UNIVERSITY OF CALIFORNIA, BERKELEY College of Engineering Electrical Engineering and Computer Sciences Department EECS 145M: Microcomputer Interfacing Laboratory Spring Midterm #2 (Closed book- equation sheet provided- calculators OK) Wednesday, April 21, 2004 PROBLEM 1 (16 points) 1a (8 points) When periodically sampling a waveform, what causes frequency aliasing and how can it be avoided? 1b (8 points) When periodically sampling a waveform and computing its Fourier transform, what causes spectral leakage and how can it be avoided?

Name (Last, First) EECS145M 2004 Midterm #2 Page 2 Derenzo PROBLEM 2 (25 points) Design a Butterworth anti-aliasing low pass filter that meets the following requirements:

  • Gain > 0.99 for frequencies below 20 kHz
  • Gain < 0.01 for frequencies that alias below 20 kHz
  • The sampling frequency is 80 kHz
  • The filter has the minimum number of components (lowest order)

Name (Last, First) EECS145M 2004 Midterm #2 Page 4 Derenzo 3d. (15 points) List the hardware and software steps necessary to sample the data, to determine the frequency values, and to determine relative amplitudes. 3e. (5 points) Would your system work if f 1 = 3000 Hz and f 2 = 3001 Hz? If not, how could you modify your procedure to determine these frequencies?

Name (Last, First) EECS145M 2004 Midterm #2 Page 5 Derenzo Problem 4 (24 points) Power lines operate at 60 Hz, but distortion of the harmonic waveform caused by inductive loads can introduce a 180 Hz component that is harmful to transformers. Design a system for using a computer (equipped as in problem 3) and digital filtering to continually monitor the amplitude of the unwanted 180 Hz component of the power line waveform. Assume that you continuously sample the 115 volt AC power line at 180 x 1024 Hz = 184,320 Hz. 4a. (12 points) List the hardware and software steps necessary to sample the data, to continually compute the 180 Hz amplitude using a finite impulse response digital filter, and to continually print the amplitude to the computer screen.

April 21, 2004 page 1 S. Derenzo

Solutions for Midterm #2 - EECS 145M Spring 2004

1a Frequency aliasing is caused by sampling at a frequency fs that is less than twice the highest frequency fmax in the waveform. It may be avoided by (i) increasing the sampling frequency so that fs > 2 fmax or (ii) using an analog low-pass filter to eliminate frequencies above fs/2. [either were accepted for full credit] 1b Spectral leakage is caused when frequency components are not sampled for a whole number of cycles, which results in a discontinuity between the last sample and the “next sample”, which is also the first sample. It is avoided by multiplying the sampled values by a windowing function that has zero value and zero slope at the ends of the sampling window. [3 points off if the only answer is to sample for an integer number of cycles- most waveforms contain many harmonics] 2 n = 8; f 1 /fc = 0.784; fc = 25.5 kHz; f 2 /fc = 1.778; f 2 = 45.4 Hz; fs = f 1 + f 2 = 65.4 kHz n = 6; f 1 /fc = 0.723; fc = 27.7 kHz; f 2 /fc = 2.154; f 2 = 59.6 Hz; fs = f 1 + f 2 = 79.6 kHz n = 6, fc = 27.7 kHz best meets the requirements 3a The system is quite simple, since most of the control and data transfer lines are internal. An anti-aliasing filter is not needed since we know that the highest frequency in the signal is 100 kHz. Analog I/O port μComp 3b Sample at 262,144 Hz for 1 second to take 262,144 samples (a power of 2) 3c The successive approximation, flash, and half-flash would have the necessary speed and accuracy [2 points off for tracking, which would be too slow] 3d 1 program sets value[M] = 0 2 program tells the analog I/O board to take M = 262,144 samples at 262,144 Hz and store in vector value[ ] 3 program loops until value[M] = –1 while analog I/O board acquires samples 4 multiply sampled values by Hann window 5 take fast Fourier transform to get complex frequency values Hn 6 Convert complex values to magnitude values

Fn = [ Re(Hn )]

2

+ [Im( H n )]

2 7 scan though the Fn values to identify the two peaks at n 1 and n 2

April 21, 2004 page 2 S. Derenzo 8 the two frequencies are f 1 = n 1 Hz and f 2 = n 2 Hz 9 because of short-range spectral leakage, there will be side lobes at n 1 -1, n 1 +1, n 2 -1, and n 2 +1. But these side lobes will have amplitudes proportional to the main peak so F2/F1 is a good estimate of the amplitude ratio. [2 points off for omitting the Hann window- there was no guaranty that both f 1 x S and f 2 x S are integers.] 3e The two amplitude peaks will occur at F 3000 and F 3001. Because of the short-range spectral leakage, there will be non-zero values at F 2999 , F 3000 , F 3001 , and F 3002. The design using S = 1 sec does not work, because if one harmonic is much stronger than the other, the weaker harmonic will be lost in the ±1/S side lobes of the stronger harmonic. In addition, the result is the same as a single harmonic of a frequency between 3000.0 and 3001.0 Hz, depending on the relative amplitudes. To see the 3000 and 3001 Hz components as separate peaks in spite of the ±1/S side lobes, sample for 4 seconds (1,048,576 samples), use the Hann window and take the fft. The result will be two peaks centered at F 12000 and F 12004. [full credit if the design sampled for 4 seconds in part 3b; then 3e works without modification] 4a In this problem we are only interested in the Fourier magnitude at 180 Hz. There is no need to perform the fft and get the magnitudes at all frequencies. Note that this problem was the subject of lecture slide 298. 1 sample 3072 values hk over 1/60 sec. 2 use finite impulse response filters to compute the real and imaginary Fourier components Re(H 3 ) = hk cos( 2 πk 3 / 3072 ) k = 0 3071 ∑ Im(H 3 ) = hk sin( 2 πk 3 / 3072 ) k = 0 3071 ∑ (Since the sampling window is S = 1/60 seconds, the 180 Hz Fourier coefficient is H 3 .) 3 compute and display the magnitude value at 180 Hz

F 3 = [Re( H 3 )]

2

+ [Im( H 3 )]

2 4 shift all the hk values down, delete the old h 0 , and sample a new value h 1023. 5 go back to step 2 (Note that to perform steps 2-5 at 184 kHz. the multiplications and additions in step 2 must be performed at 368 Mhz; this requires high-speed processors) [2 points off for not sampling waveform] [2 points off for sampling for only 1/180 sec; spectral leakage from the 1/3 cycle of 60 Hz would overwhelm] [5 points off for using a FIR digital filter but not giving an equation for it] [6 points off for sampling for 1/60 sec and doing the full FFT] 4b Note that this problem was the subject of lecture slides 299 and 300. 1 sample 3072 values hk over 1/60 sec.