Sie sind auf Seite 1von 16

Systems and Techniques for Digital Signal Processing

A.Y. 2014-15
General examination rules
The examination of the course of Systems and Techniques for Digital Signal Processing consists
of a written test, a PC-based home exercise and a final oral exam.

The written test (60% of the final grade) includes 3-4 questions (typically 2 open theoretical
questions and 2 exercises). The test lasts 2 hours.
The home exercise (30% of the final grade) should be developed in Matlab or a similar
software tool (such as Octave or Scilab). Results have to be summarized in a report of no
more than 8 pages (excluding the title page and possible Annexes). The report has to be
strictly focused on the results of the exercise with a clear explanation of the design choices
and the related motivations. No general theoretical aspects has to be included in the
report. The grade of this part of the exam is based on both the completeness of the
exercise and the clarity of the report. The source code should be properly commented.
The oral exam (10% of the final grade) aims at clarifying some points of the written test
and/or of the home exercise. In some cases, one or two extra questions are also possible.

Exercise submission and oral examination rules


Every student is required to choose and to develop in Matlab one of the exercises reported in the
following list. Some exercises can be done in pairs, but only if this is explicitly indicated in the text
of the exercise. After choosing an exercise, each student is invited to send an email to
david.macii@unitn.it declaring his/her choice (e.g. Mario Rossi Exercise 1). If too many students
choose the same exercise, some of them will be redirected towards other exercises.
Copying verbatim source code, plots or other relevant parts of the exercise solution from the
web or from projects by other students is strictly forbidden. Students that are discovered to
submit non-original material will not be allowed to take the exam for two sessions.
Both the report and the source files has to be sent to: david.macii@unitn.it
Normally (see exceptions for winter session 2014-2015 below), the home exercise and the
related report should be submitted by the date of the written test. However, they will be
evaluated only if the written test has at least a sufficient grade. In this way, students that fail the
written test or that withdraw, can reuse the same exercise in a future examination session.
Nonetheless, to avoid confusion, all students that repeat the exam are required to resubmit the
same files again, in the proximity of the new examination date.
Students that decline the final grade (typically because they want a better one) have the option to
do a new home exercise. However, this is not compulsory.

The oral exam will be usually scheduled about one week after the written test. Changes with
respect to the dates reported in ESSE3 are possible. Students are always invited to check the sheet
with the test results to have more precise information about the oral schedule associated to a
specific examination session.
Normally (see exceptions for winter session 2014-2015 below), students are required to take the
oral exam in the same examination session of the written test. Students that do not show up at
the oral exam without a proper justification will be regarded as absent and will lose the grade
of both written test and home exercise even if positive.
EXCEPTIONS FOR WINTER SESSION 2014-2015. In consideration of the novelty of the course and
of the limited time between the end of the classes and the examination dates, the submission and
oral exam rules for all students taking the exam in January-February 2015 will be relaxed as
follows:

The report and the project can be submitted even after the date of the written test.
If the home exercise is submitted too late to be discussed in the January session, the oral
exam will be scheduled in the February session.
If the home exercise is submitted too late to be discussed in the February session, an
extraordinary oral examination session will be scheduled in March or April, whenever
possible.

Exercise list
Exercise 1 Spectral data analysis (max. 2 people)
An encoder installed on a wheel generates a stream of pulses of amplitude 0-5 V, duration equal
to 100 s and frequency ranging from 0 Hz (0 at RPM) to 4 kHz (at 4000 RPM), depending on the
rotational speed of the wheel. Because of the vibrations, the period of the generated train of
pulses exhibits a random phase noise in the order 5 s (peak-to-peak). In addition, the signal is
affected by a non-stationary noise with zero mean and standard (deviation proportional to speed)
ranging from 1 mV (min) to 20 mV (max).
1. Model the signal as if it were time-continuous (the sampling period should be much
smaller than signal period) and show that it behaves as expected.
2. Design a data acquisition stage (in terms of anti-aliasing filter, sampling rate, number of
bits for A/D conversion, window length and type) able to provide a good spectral
estimation of the signal in the worst-case scenario (i.e. when the signal frequency is
maximum).
3. Implement a spectral estimator.
4. Compare the performances (in terms of leakage, spectral resolution etc) of at least three
alternatives.
Justify your decisions and comment your results in the report.

Exercise 2 Data acquisition and filtering


An inverter powering an electric motor generates a 100-Hz 24 V sine-wave affected by a
wideband noise of 1 V rms (root mean square), by a 2nd-order harmonic of amplitude equal to 10%
of the fundamental and by higher-order harmonics of amplitude decreasing as 1/f with respect to
the second.
1. Build a signal with the features described above;
2. Design a data acquisition stage (in terms of attenuation, anti-aliasing filter, sampling rate,
number of bits for A/D conversion) suitable for a 2.5-V microprocessor.
3. Design a bandpass IIR filter with a technique of your choice able to attenuate both
harmonics and out-of-band noise by at least 40 dB (transition bandwidth and in-band
ripple amplitude can be arbitrary, but the filter gain at 100 Hz must be 1).
4. Show that the filter performs as expected both in the time domain and in the frequency
domain.

Exercise 3 IIR filter design and implementation


1. Design a digital Chebyshev-I lowpass filter operating at a sampling rate of 80 kHz with a
passband edge frequency at 4 kHz, a passband ripple of 0.5 dB, and a minimum stopband
attenuation of 45 dB at 20 kHz.
2. Transform the analog filter into a digital one using the bilinear method. Plot the frequency
response, pole-zero diagram and impulse response of the digital filter. Show the steps of
the design procedure.
3. Implement the filter using a structure of your choice (the implementation should be done
with a C-style approach, i.e. by using just elementary low-level operations, i.e. MUL, ADD
and DELAYS and not using the filter Matlab function).
4. Test the filter with appropriate input stimuli and show that it behaves as expected.
5. Quantize all coefficients assuming to use a 16-bit microcontroller and Q15 notation. Plot
the frequency response, pole-zero diagram and impulse response of the quantized version.
Comment your results in the report.

Exercise 4 FIR filter design and implementation


The spectrum of an analog signal, x(t), is contained between 5 Hz and 30 Hz. The signal is
contaminated by additive noise in the frequency band 50 Hz - 60 Hz. The contaminated signal is
then sampled 100 times per second.
1. A linear-phase FIR digital filter is to be designed so as to remove the noise from the signal.
The design of the filter should be based on the Parks-McClellan algorithm.
2. Plot the frequency response, pole-zero diagram and impulse response of the digital filter.
3. Implement the filter using a structure of your choice (the implementation should be done
with a C-style approach, i.e. by using just elementary low-level operations, i.e. MUL, ADD
and DELAYS and not using the filter Matlab function).
4. Test the filter with appropriate input stimuli and show that it behaves as expected.
5. Quantize all coefficients assuming to use a 16-bit microcontroller and Q15 notation. Plot
the frequency response, pole-zero diagram and impulse response of the quantized version.
Comment your results in the report.

Exercise 5 Real-valued amplitude response


The frequency response of a linear-phase FIR filter can be written as
() = () ()
where the amplitude response A() is continuous and real-valued. Write a Matlab function that
uses the FFT to compute A() from the impulse response h(n) at the frequency points =

for k=0,,L-1. The input to your Matlab function should be a vector h containing the values of the
impulse response, the filter Type (1,2,3,4), and the number of samples L. You may assume that L is
greater than the length of the filter. The Matlab function should provide vectors A and such that
plot(,A), gives a plot of A(). An example Matlab header could be: function [A,w] =
firamp(h,type,L)
Verify that your Matlab function works correctly for each of the 4 filter types, by using it to plot
A() for the following filters.
1. Test for Type I using the following impulse response: h1 = (o/)*sinc((o/)*(n-(N-1)/2));
N = 29; n = 0:N-1; o = 0.34;
2. Test for Type II using and h2 = (o/)*sinc((o/)*(n-(N-1)/2)); N = 28; n = 0:N-1;
o = 0.34;
3. Test for Type IV using a differentiator with h4 = (-1).^(n-(N-2)/2)./(pi*(n-(N-1)/2).^2); N =
16; n = 0:N-1;
4. Test for Type III using a lowpass differentiator obtained by convolving the impulse
response of a Type II lowpass filter and Type IV differentiator, i.e. h3=conv(h2,h4).
Comment your results in the report.

Exercise 6 Speech acquisition and processing


In this exercise, at first you have to record yourself saying yes and no. You can create your
recordings using a computer or other digital recording device. In case it is not available in the
operating system, there are many utilities for both MS and Mac systems. For example, `Audacity'
is a free recording and audio editing software system for both Mac and MS.
See http://audacity.sourceforge.net/
1. Using the recording utility, you can create a wav file. You can then read the wav file into
MATLAB. Your recordings should be at 8000 Sa/s second. If they are not at that sampling
rate, then you can change them after you load them into MATLAB using the resample
command. Using MATLAB, you can form one vector of 4000 samples (half second) for
yes. You should form a second vector also of 4000 samples for no. Note that the
recording you originally make does not need to be a half second in duration; you can trim
the signal down to 4000 samples after you read the signal into MATLAB. Plot and check
that if the collected data are correct. You can use the sound function to this purpose.
2. Compute and display the spectrum of the segments corresponding to e in yes and o
in no. The vowel sounds usually are roughly periodic (i.e. mainly deterministic). Based on
the spectra that you compute, what is the pitch frequency of your speech? (The pitch
frequency is the fundamental frequency of the quasi-periodic voiced speech signal). Can
you recognize the harmonics in the spectrum?
3. Select one of the prominent equally-spaced peaks in the spectrum. Determine the
frequency of the peak from the spectrum you computed. Design a second-order notch
filter that eliminates the chosen peak (without affecting the nearby peaks).
4. Plot the frequency response, pole-zero diagram and impulse response of the digital filter.
5. Compare the signal before and after filtering.
Comment your results in the report.

Exercise 7 System identification through adaptive filtering (Max. 2 people)


System identification refers to the ability to emulate the behavior of an unknown system by tuning
the parameters of a known model in such a way that the outputs of the unknown system and of
the parametric model are reasonably close when they are stimulated by the same signal. A classic
approach for the identification of a linear system relies on adaptive FIR filtering. The basic idea is
to stimulate both the unknown system and a FIR filter with the same signal (e.g. noise) and to
compute the filter coefficients in order to minimize the difference between the outputs of both
systems in a least mean squares (LMS) sense (see picture below). It is worth reminding that any IIR
system can be always approximated by an FIR system provided that the IIR impulse response is
truncated after a reasonably long number of terms.

Assuming that the unknown system is described by the following difference equation:
() = 1 ( 1) + 2 ( 2) + () + 1 ( 1) + 2 ( 2)
where the values of coefficients a1, a2, b1 and b2 can be chosen arbitrarily (provided that the
system is stable), you have to
1. Test the system and plot its input and frequency response;
2. Implement a noise generator able to stimulate the system and plot the output of the
system;
3. Implement a LMS function to adaptively adjust the coefficients of an FIR filter minimizing
E{e2(n)} (refer to some literature for a better understanding of LMS adaptive filter design).
The function is supposed to have as inputs:
the input stimulus sequence;
the corresponding desired output d;
the length N of the adaptive FIR filter;
a step size parameter controlling the rate of convergence of the algorithm to the
optimal solution.
(compulsory for 2 people only) The routine above could be also used iteratively in order to
increase the value of N till when the mean square error E{e2(n)} does not change
significantly.
4. Implement the adaptive FIR filter module with the filter coefficients given by the algorithm
above.
5. Compare the output of both systems stimulated by a different signal (e.g. a sinewave).
6. (compulsory for 2 people only) Plot the histograms, mean values and variances of the
output errors in both cases (noise and sinusoidal stimulation).
Comment your results in the report.

Exercise 8 Narrowband disturbance cancellation through adaptive filtering (Max. 2 people)


Let us assume that we have a signal sequence x(n) that consists of a desired wideband signal
sequence, say w(n), corrupted by an additive narrowband interference sequence s(n). The two
sequences are uncorrelated. From a filtering point of view, our objective is to design a filter that
suppresses the narrowband interference. In effect, such a filter should place a notch in the
frequency band occupied by the interference. In practice, however, the frequency band of the
interference might be unknown. Moreover, the frequency band of the interference may vary
slowly in time.
The narrowband characteristics of the interference allow us to estimate s(n) from past samples of
the sequence x(n) = s(n) + w(n) and to subtract the estimate from x(n). Since the bandwidth of s(n)
is narrow compared to the bandwidth of w(n), the samples of s(n) are highly correlated.

Given the block diagram in the picture,


1. Implement a zero-mean random noise generator and a sine wave with power 10 times
larger than the power of noise and frequency chosen at random.
2. Implement a Least Mean Squares (LMS) function to adaptively adjust the coefficients of the
FIR filter minimizing E{e2(n)}= {(() ())2 } (refer to some literature for a better
understanding of LMS adaptive filter design, e.g. Wiener filter). The function is supposed to
have as inputs:
the input stimulus sequence;
the corresponding desired output d;
the length N of the adaptive FIR filter;
a step size parameter controlling the rate of convergence of the algorithm to the
optimal solution.
3. Implement the adaptive FIR filter module with the filter coefficients given by the algorithm
above.
4. It is interesting to plot the sequences w(n), s(n), and x(n). It is also interesting to plot the
frequency responses of the filter after the LMS algorithm has converged.
5. (compulsory for 2 people only) The effect of the length of the adaptive filter on the quality
of the estimate should be investigated, e.g. by plotting the values of E{e2(n)} as a function
on N.
6. (compulsory for 2 people only) The project may be generalized by adding a second sinusoid
of a different frequency. Then the frequency response of the FIR filter should exhibit two
resonant peaks, provided the frequencies are sufficiently separated. Investigate the effect
of the filter length N on the resolution of two closely spaced sinusoids.
Comment your results in the report.

Exercise 9 Binary data communication system through a noisy channel


The purpose of this exercise is to investigate the performance of binary data communication
system on an additive noise channel. Five MATLAB functions have to be implemented.
1. A binary data generator module that generates a sequence of independent binary digits
with equal probability.
2. A modulator module that maps a binary digit 1 into a sequence of M consecutive +1s, and
maps a binary digit 0 into a sequence of M consecutive 1s. Thus, the M consecutive +1s
represent a sampled version of the rectangular pulse.
3. A noise generator that generates a sequence of uniformly distributed numbers over the
interval (a, a), with a chosen arbitrarily. Each noise sample is added to a corresponding
signal sample.
4. A demodulator module that sums the M successive outputs of the noise corrupted
sequence +1s or 1s received from the channel. We assume that the demodulator is time
synchronized so that it knows the beginning and the end of each waveform.
5. A detector and error-counting module. The detector compares the output of the
modulator with zero and decides in favor of 1 if the output is greater than zero and in favor
of zero if the output is less than zero.
If the output of the detector does not agree with the transmitted bit from the transmitter, an
error is counted by the counter. The error rate depends on the ratio (called signal-to-noise ratio)
of the size of M to the additive noise power, which is Pn = a2/3. The measured error rate can be
plotted for different signal-to-noise ratios, either by changing M and keeping Pn fixed or vice versa.

Exercise 10 IIR filter design and comparison


1. Design an analog Butterworth and an elliptic lowpass filter that have a 0.25 dB or better
ripple at 500 rad/s and at least 50 dB of attenuation at 2000 rad/s.
2. Determine the system function in a rational function form. Plot the magnitude response,
the log-magnitude response in dB, the phase response and the impulse response of the
filter. Compare the performances of the two filters.
3. Implement one of the two filters using a structure of your choice (the implementation
should be done in a C-like style by using simple low-level operations, i.e. MUL, ADD and
DELAYS and not using the filter Matlab function).
4. Test the filter with appropriate input stimuli and show that it behaves as expected.
Comment your results in the report.

Exercise 11 FIR filter design and comparison


1. Design a linear-phase band-pass filter using the Hann window. The specifications are:
lower stopband edge: 0.2
upper stopband edge: 0.75 with As = 40 dB
lower passband edge: 0.35
upper passband edge: 0.55 with Rp = 0.25 dB
At first do not use the fir1 function. Then compare your results with those obtained with
the fir1 function.
2. Design a minimum-length, linear-phase bandpass filter with same specifications using the
Parks-McClellan algorithm.
3. Plot the amplitude response of both designed filters. Compare the order of both filters. In
the case of the Parks-McClellan filter count the total number of extrema in passband and
stopbands. Verify this number with the theoretical estimate of the total number of
extrema.
4. Implement one of the two filters using the so-called folded structure (the implementation
should be done in a C-like style by using simple low-level operations, i.e. MUL, ADD and
DELAYS and not using the filter Matlab function).
Comment your results in the report.

Exercise 12 FIR filter design, overlap & save and overlap & add
1. Design a staircase filter using the Kaiser window approach. The specifications are:
Band-1: 0 0.3, Ideal gain = 1, 1 = 0.01;
Band-2: 0.4 0.7, Ideal gain = 0.5, 2 = 0.005;
Band-3: 0.8 , Ideal gain = 0, 3 = 0.001;
2. Generate a signal composed by the wanted sinewave in Band-1, a smaller sinusoidal
interferer in Band-2 and white noise. Choose the noise power as well as sine-wave
frequencies and amplitudes as you want.
3. Implement the FIR filter using the overlap & save algorithm. To this aim, write your own
function, with the following input arguments:
input sequence;
block size L.
4. Implement the FIR filter using the overlap & add algorithm. To this aim, write your own
function, with the same input arguments as before.
5. Check the correct operation of the filters by comparing your results with those obtained
with a Matlab function.
6. Compare the computation times of both algorithms for some values of L.
Comment your results in the report.

Exercise 13 Quantization noise and numerical issues


1. Write a Matlab function y = quant_fix(x,B, Qmode,Omode) performing a fixed-point 2s
complement quantization using (B+1) bit in QB notation so that the resulting number y lies
in 1 y < 1. The quantization mode option, Qmode, is either a rounding or a truncation
operation. The overflow option Omode should perform either saturation or 2scomplement overflow.
2. Digital filters are linear systems, but when quantizers are incorporated in their
implementation, they become nonlinear systems. For nonlinear systems it is possible to
have an output sequence even when there is no input. A zero-input limit cycle is a nonzero
periodic output sequence produced by nonlinear elements or quantizers in the feedback
loop of a digital filter. Consider the 1st-order recursive system
y(n)=0.75 y(n 1) + 0.125(n)
with zero initial conditions. The filter is implemented in 4-bit (including sign) fixed-point
2s-complement fractional arithmetic. Products are rounded to 3-bits.
Determine and plot the first 20 samples of the output using saturation limiter for
the addition. Does the filter go into a limit cycle?
Determine and plot the first 20 samples of the output using twos-complement
overflow for the addition. Does the filter go into a limit cycle?
3. Consider a 5th-order FIR system given by
H(z)=0.1+0.2z1 + 0.3z2 + 0.3z3 + 0.2z4 + 0.1z5
which is implemented in a direct form using B = 10 bits. Input to the filter is a random
sequence whose samples are independent and identically distributed over [1, 1].
Investigate the output quantization errors when all 6 multipliers are used in the
implementation (rounding with 2s complement overflow). In this case each
multiplier output is quantized (case a). Plot the normalized histogram of the output
error, as well as its mean value and variance.
Investigate the output quantization errors when quantization is performed only
after the final sum (rounding with saturation-based overflow). In this case, typical
of fixed-point DSP architectures with a multiply-and-accumulate data-path, (case b)
the numerical error is introduced mainly at the end of computation. Plot the
normalized histogram of the output error, as well as its mean value and variance.

4. Assume to stimulate the filter with a sinusoidal signal with amplitude equal to 2. Avoid
overflow using the most suitable scaling technique you know. Compute numerically the
SNR values in both case a and case b, with and without scaling.
Comment your results in the report.

Exercise 14 DTMF tone generation and detection (Max. 2 people)


The objective of this project is to gain an understanding of Dual Tone Multifrequency (DTMF)
generation and decoding. DTMF is the generic name for push-button telephone signaling. It finds
widespread use in electronic mail systems and telephone banking systems in which the user can
select options from a menu by sending DTMF signals from a telephone.
In a DTMF signaling system a combination of a high-frequency tone and a low-frequency tone
represent a specific digit or the characters * and #. The eight frequencies are arranged as shown in
the figure to accommodate a total of 16 characters, 12 of which are assigned as shown, while the
other four are reserved for future use.

The detection algorithm can be a DFT implementation using the FFT algorithm or a filter bank
implementation. Design the following MATLAB modules:
1. a tone generation function that accepts an array containing dialing digits and produces a
signal containing appropriate tones (as shown in the figure) of 0.5-s duration for each digit
at 8 kHz sampling rate;
2. a dial-tone generator generating samples of (350 + 440) Hz frequency at 8 kHz sampling
interval for a specified amount of duration;
3. a decoding function that accepts a DTMF signal and produces an array containing the
dialing digits.
Generate several dialing list arrays containing a mix of digits and dial tones. Experiment with the
tone generation and detection modules and comment your observations in the report. Optionally
you can use MATLABs sound generation capabilities to listen to the tones and to observe the
frequency components of the generated tones.

Das könnte Ihnen auch gefallen