





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The solutions to midterm 2 of the eecs 145m: microcomputer interfacing laboratory course at the university of california. The solutions cover topics such as frequency aliasing, spectral leakage, anti-aliasing filters, windowing functions, and the fast fourier transform.
Typology: Exams
1 / 9
This page cannot be seen from the preview
Don't miss anything!






College of Engineering
Electrical Engineering and Computer Sciences Department
EECS 145M: Microcomputer Interfacing Laboratory
Spring Midterm #2 (Closed book- equation sheet provided- calculators OK)
Full credit can only be given if you show your work.
Wednesday, April 7, 2010
PROBLEM 1 (20 points)
1.1 (10 points) When periodically sampling an arbitrary waveform, what causes frequency
aliasing and how can it be reduced?
1.2 (10 points) When periodically sampling an arbitrary waveform and computing its Fourier
transform, what causes spectral leakage and how can its long-range effects be reduced?
PROBLEM 2 (50 points)
You have designed and built a computer system to sample waveforms and perform the FFT.
It has the following characteristics:
18
Hz = 262,144 Hz
16
= 100,000 Hz
Answer the following questions:
2.1 (3 points) For what frequency range does the anti-aliasing filter have gain >0.99?
( Hint: Use the Butterworth gain table on the equation sheet)
2.2 (3 points) For what frequency range does the anti-aliasing filter have gain <0.01?
2.3 (2 points) How long does it take to acquire the samples?
2.4 (3 points) To what frequencies do the FFT coefficients H 0
and H 1
correspond?
2.5 (4 points) What is the FFT coefficient with the highest frequency index and to what
frequency does it correspond?
2.11 (7 points) You sample a sinewave of frequency 2
18
FFT. What FFT coefficients should be non-zero? How does the magnitude of the largest
FFT coefficient compare with that you would get if you sampled an 84,000 Hz sinewave?
2.12 (4 points) What would you change so that the FFT can resolve peaks twice as close as
your answer to part 2.10?
PROBLEM 3 (total 30 points):
You are given a waveform that repeats with a frequency of 10 kHz and contains frequency
components only up to 10 MHz.
3.1 (10 points)
Describe the Integral Fourier Transform of this waveform and the location of the lowest and
highest harmonics present.
3. 2 (10 points)
You take 2000 samples of the waveform of part 3.1 at a sampling frequency of 20 MHz and take
the Fast Fourier Transform.
Describe the Discrete Fourier amplitudes of this waveform and the frequency coefficients of the
lowest and highest harmonics present
April 7, 2010 page 1 S. Derenzo
1.1 Frequency aliasing is caused by sampling at a frequency f s
that is less than twice the highest
frequency f max in the waveform.
It may be avoided by using an analog low-pass filter to eliminate frequencies above f s
[4 points off for increasing the sampling frequency. When sampling an arbitrary waveform
you don’t know the maximum frequency.]
1.2 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 for a solution that samples for a longer time- this does not eliminate the
discontinuity and long-range spectral leakage will still occur]
[3 points off if the only answer is to sample for an integer number of cycles- nothing is
known about the frequency components present]
2.1 Filter gain >0.99 for frequencies <78,400 Hz
2.2 Filter gain <0.01 for frequencies >177,800 Hz
2.3 S = M ∆t = M/f s
16
18
Hz = 0.25 s
0
corresponds to 0 Hz (d.c.); H 1
corresponds to 1/S = 4 Hz
2.5 The FFT produces coefficients H n
, where n = 0 to M–1. Therefore, the coefficient with the
highest index is H M- 1 or H 65, , which corresponds to 4 Hz.
[2 points off for H M
and 0 Hz] [3 points off for H M
and 2
18
Hz]
2.6 The FFT coefficient that corresponds to the highest frequency is H M/
or H 32,
. The
corresponding frequency is (M/2)/S = 131,072 Hz
2.7 For a 4,000 Hz sinewave, the primary FFT coefficients are H 1000
and H M- 1000
. Additional
neighboring coefficients H 999
1001
M- 999
, and H M- 1001
are non-zero (actually half the value
of the primary coefficients) due to the side lobes produced by the Hann window.
[2 points off for omitting side lobes] [2 points off for omitting H M- 999
M- 1000
, and H M- 1001
2.8 For a 4,000 Hz symmetric square wave, a sequence of harmonics will appear at odd
multiples of the 4,000 Hz fundamental. So H k and H M-k would be non-zero, and the
Hann side lobes would be at H k1000- 1
k1000+
M-k1000- 1 , and H M-k1000+
[1 point off for omitting side lobes] [3 points off for omitting harmonics]
2.9 For a 4,002 Hz sinewave, H 1000
1001
M- 1000
, and H M- 1001
would be non-zero and of equal
magnitude, and the Hann side lobes would appear at H 999
1002
M- 999
and H M- 1001
[1 point off for omitting side lobes] [2 points off for omitting H M- 1000
and H M- 1001
[4 points off for stating that all coefficients are non-zero]
2.10 The primary 4,000 Hz sinewave would produce non-zero values at H 999
1000
, and H 1001
second smaller sinewave of slightly higher frequency 4,000 + 4m Hz would produce non-
zero values at H 1000+m- 1
1000+m , and H 1000+m+ (there are also complex conjugate
coefficients at H M- 1000 , etc.). For the smaller sinewave to appear as a separate peak, there
must be a valley between the coefficient H 1001
and the coefficient at H 1000+m
, which requires
1000 + m > 1002, or m >2. The smallest value of m we can have is 3, which corresponds to
a frequency 12 Hz above 4,000 Hz.
April 7, 2010 page 2 S. Derenzo
[4 points off for 4 Hz] [3 points off for 8 Hz] [both 12 Hz and 16 Hz were accepted]
1000 1002 1004
2.11 A sinewave of frequency 4M – 84,000 Hz = 178,144 Hz will produce non-zero coefficients
at H 20999
21000
21001
M- 20999
M- 21000 , and H M- 21001
16
A sinewave of frequency 84,000 Hz will produce non-zero coefficients at exactly the same
frequency indexes. This is an example of how a higher frequency can alias to a lower
frequency. However, the 84,000 Hz sinewave will be only slightly reduced by the anti-
aliasing filter (gain >0.90, while the 178,144 Hz sinewave will be greatly reduced (gain
≈0.01). So the coefficients will be about 100 times smaller for the 178,144 Hz sinewave.
[3 points off for not stating the non-zero coefficients]
[1 point off for omitting H 20999
21001
M- 20999 , and H M- 21001
[3 points off for stating that the magnitudes are the same for sampling 178,144 and 84,
Hz]
2.12 To reduce the answer to 2.10 by a factor of two (i.e. to 6 Hz), sample for twice as long.
[2 points off for doubling the sampling frequency, which increases the number of Fourier
coefficients but not the frequency spacing ∆f = 1/S]
3.1 The Integral Fourier Transform will be zero except for integer multiples of the 10 kHz repeat
frequency. The relative Fourier Amplitudes will depend on the waveform.
The lowest (1st) harmonic will appear at 10 kHz
The highest (1000th) harmonic will appear at 10 MHz
3.2 M = 2000 samples at f S = 20 MHz correspond to a sampling window S = M/f S = 100μs,
which is one cycle of the waveform.
The Discrete Fourier Transform will have harmonics k = 1 to 1000 at H 1 to H 1000 and their
complex conjugates at H 1001 to H 1999
The first harmonic is H 1 at 10 kHz, which is one cycle per 100 μs
The highest harmonic H 1000 at 10 MHz
3.3 Viewing this problem in the time domain the waveform has a period of 1/10kHz = 100μs.
The sampling period of 1/9.995kHz = 100.05μs. Each sample will be progressively later by