EECS 145M Spring 2004 Midterm #2 Solutions - Sampling & Fourier Transform, Exams of Microcomputers

The solutions for midterm #2 of the eecs 145m spring 2004 course. It covers topics such as frequency aliasing, spectral leakage, and the fourier transform. The solutions include calculations for various sampling frequencies, the use of filters, and the identification of peak frequencies.

Typology: Exams

2012/2013

Uploaded on 03/22/2013

sarup
sarup 🇮🇳

30 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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]
2n = 8; f1/fc = 0.784; fc = 25.5 kHz; f2/fc = 1.778; f2 = 45.4 Hz; fs = f1 + f2 = 65.4 kHz
n = 6; f1/fc = 0.723; fc = 27.7 kHz; f2/fc = 2.154; f2 = 59.6 Hz; fs = f1 + f2 = 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
1program sets value[M] = 0
2program tells the analog I/O board to take M = 262,144 samples at 262,144 Hz and store
in vector value[ ]
3program loops until value[M] = –1 while analog I/O board acquires samples
4multiply sampled values by Hann window
5take fast Fourier transform to get complex frequency values Hn
6Convert complex values to magnitude values
F
n=Re(Hn)
[ ]
2+Im(Hn)
[ ]
2
7 scan though the Fn values to identify the two peaks at n1 and n2
pf3

Partial preview of the text

Download EECS 145M Spring 2004 Midterm #2 Solutions - Sampling & Fourier Transform and more Exams Microcomputers in PDF only on Docsity!

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

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.