advanced digital system
301SE – ADVANCED DIGITAL SYSTEM
ASSIGNMENT – JAN 2019
1. Download the file “Q1_256gray.bmp” into a folder accessible by MATLAB. Write a
MATLAB program to implement the histogram equalization algorithm. Comments
must be included to explain the algorithm clearly. Do not use standard built-in
function such as histeq().
Plot the images and their histograms before and after the equalization.
(15 marks)
2.
a. Find and simplify the mathematical expression for the convolution of
ℎ��� ⨂ ���� for
���� = ��
����; ℎ��� = ��
����. (5 marks)
b. Write a MATLAB program to implement convolution function given by
���� = ℎ��� ⊗ ���� = ∑ ℎ������ − ������ .
Comments must be included for explanatory purpose. Do not use built-in
function conv().
Use MATLAB function written to compute the convolution over the range
0 ≤ � ≤ 20 and plot the result. (15 marks)
3. In this Problem you are to perform spectral analysis on the audio signals provided.
You are given a short piano piece “piano_sequence.wav” of duration 3 measures.
The second musical note and first chord (combination of notes) are given separately
in “piano_single_note.wav” and “piano_chord.wav” respectively.
Write a MATLAB program to perform the followings:
a. Read “piano_single_note.wav” into a vector x.
b. Determine the sampling rate and number of samples in x.
c. Use MATLAB built-in function to perform DFT on x, and save the result in X.
d. Create an array freq (in Hz) that represents the actual frequencies
corresponding to the indices of X.
e. Plot the |X(f)| vs freq from 0Hz to 3kHz.
f. From the spectrum, determine the fundamental frequency and its harmonics.
(10 marks)
g. Repeat the same spectra analysis for “piano_chord.wav”, including plotting
|X(f)| vs freq.
h. From the spectrum of “piano_chord”, determine the number of musical
notes in the chord. What are the fundamental frequencies of these notes?
(5 marks)
4. Filter design using Filter Design and Analysis Tool.
a. A low pass filter has the following specifications
i. Sampling frequency 48kHz
ii. Passband attenuation (Apass) = 1 dB
iii. Stopband attenuation (Astop) = 60 dB
iv. Passband edge (fpass) = 6kHz
v. Stopband edge (fstop) = 8kHz
Design a low pass IIR Butterworth filter with minimum order to meet the
above specifications
What is the order of the filter? What are the filter coefficients? Plot the
magnitude response and the phase response for this filter. Also, show the
pole-zero plot.
(8 marks)
b. Design an IIR, Chebyshev type 2 filter for the same specifications in (a). What
is the order of the filter? What are the filter coefficients? Plot the magnitude
response and the phase response for this filter. Show the pole-zero plot for
the filter.
(8 marks)
c. Compare the results of part (a) with the results of part (b).
(4 marks)
5. Exporting your filter designs in 4(a) and 4(b) to SIMULINK.
In SIMULINK, create two signals � ���, ����� supposition with a band limited white noise as follow:
�� = 0.000021 “#$ noise power: 0.0000021
� ��� = sin(2)* ���+ + noise, * = 3012 ����� = sin(2)*����+ + noise, *� = 12012
Inject the signals to the filters, and plot the input and output signals in the time-
domain before and after the filters, for all 4 three cases (2 signals x 2 filters). From
the filter design frequency response, estimate the attenuation expect at 3kHz and
12kHz. Comment on the waveforms.
(15 marks)
6. Write a structural VHDL code to implement a simple full adder circuit using basic
and-, or-, xor- gates. Comments must be included for explanatory purpose. Write a
small test bench code to perform simulation and verification. (15 marks)
END