MATLAB代写-ESE531
时间:2022-03-29
ESE531 Spring 2022
University of Pennsylvania
Department of Electrical and System Engineering
Digital Signal Processing
Project 1: Filter Design and Filter Banks Thursday, March 17th
Due: Tuesday, March 29th, 11:59pm
Project Teams: You should work individually and are required to complete Part A and
Part B for full credit. Part C and D are extra credit.
1. Part A: FIR FILTER DESIGN 2-WAYS In this problem you will design FIR filters
using three different methods discussed in lecture.
(a) Design an FIR filter using Truncation
Ideally, a low-pass filter with cutoff frequency ωc should have a frequency response
of
Hideal(e
jω) =
{
1, |ω| ≤ ωc
0, ωc < ω ≤ pi
and a corresponding impulse response of
hideal[n] =
ωc
pi
sinc
(ωcn
pi
)
for −∞ < n <∞
However, no real filter can have this frequency response because hideal[n] is infinite
in duration. One method for creating a realizable approximation to an ideal filter
is to truncate this impulse response. A truncated impulse response is of finite
duration, yet the filter is still noncausal. In order to make the FIR filter causal,
it must be shifted to the right by M units.
To examine the effect of filter size on the frequency characteristics of the fil-
ter, write a Matlab function LPFtrunc(N) that computes the truncated and
shifted impulse response of size N for a low pass filter with a cutoff frequency
of ωc = 2.0. For each of the following filter sizes, plot the magnitude of the filters
DTFT in decibels. Hints: The magnitude of the response in decibels is given by
|HdB(ejω)| = 20log10|H(ejω)|. Note that the log command in Matlab computes
the natural logarithm. Therefore, use the log10 command to compute decibels.
To get an accurate representation of the DTFT make sure that you compute at
least 512 sample points using the command [X,w]=DTFT(filterResponse,512).
Design two filters with size N=21 and N=101.
• Submit the plots of the magnitude response for the two filters (not in deci-
bels). On each of the plots, mark the passband, the transition band and the
stopband.
• Submit the plots of the magnitude response in decibels for the two filters.
1
ESE531 Spring 2022
• Explain how the filter size effects the stopband ripple. Why does it have this
effect?
Now download the noisy speech signal nspeech2.mat, and load it into the Matlab
workspace. Apply the two filters with the above sizes to this signal. Since these
are FIR filters, you can simply convolve them with the audio signal. Listen
carefully to the unfiltered and filtered signals, and note the result. Can you hear
a difference between the two signals? In order to hear the filtered signals better,
you may want to multiply each of them by 2 or 3 before using sound.
(b) Design a symmetric low-pass FIR filter using firpmord and firpm in Matlab to
meet the design specifications given below:
ωp = 1.8
ωs = 2.2
δp = 0.05
δs = 0.005
Compute the DTFT of the filters response for at least 512 points, and use this
result to compute the passband and stopband ripple of the filter that was de-
signed. Adjust the filter length until the minimum order which meets the design
constraints is found. Plot the magnitude of the DTFT in dB of the final filter
design.
Submit the final measured values of filter length, passband ripple, and stopband
ripple. How accurate was the filter order computation using Matlabs firpmord?
Submit the plot of the filters DTFT.
2. Part B: MULTI-CHANNEL FIR FILTER-BANK IN ONE DIMENSION
You are to implement a perfect reconstruction filter-bank (PR-FB) using Matlab, and
apply it to one-dimensional signals (audio). You can use Matlab routines such as
firpr2chfb and mfilt.firdecim, etc., for this purpose.
(a) Design a 4-channel octave band scheme, in which the full-band is decomposed into
2 low frequency bands (1/8 of full-band each), an intermediate 1/4 of full-band,
and the upper 1/2 high-frequency band. Use reasonable parameter values (filter
length and band edges for the filters). Filter length should not be unreasonably
long.
(b) To test the filter-bank, use a simple test signal such as a number of sinusoids at
different frequencies, or any other test signal of your choice. Submit plots to show
your test signals to demonstrate the filter-bank operation.
Project Submission: Your report submission for this project will consist of two
parts.
• Project Report:
You should submit by the due date a single file project report (preferably pdf)
explaining what you did and the results you obtained, including figures, test cases,
2
ESE531 Spring 2022
interpretations and comments, as well as responses to any specific questions asked
above. You do not need to include your code in your report unless you refer to
it in your write-up. If you must include it do so in an Appendix. The report
must be uploaded to Canvas by midnight on the due date.
• MATLAB Code and Other Soft Files: Also submit (upload) by the due date
through the Assignments Area on the ESE 531 Canvas Site all supporting material
(all your Matlab code files, test input/output files, and any other results files).
Ideally all placed in a compressed .zip file. Please make sure you follow the proper
procedure for submitting files through Canvas.
3
ESE531 Spring 2022
3. Part C: FILTER-BANK EQUALIZER
Use the filter-bank from Part B on an audible waveform such as a segment of music or
speech.
(a) Use the filter-bank to implement a simple equalizer for the speech or music; by this
we mean impart different gains on the 4 subband signals before reconstruction,
to enhance certain frequency bands relative to others (e.g. bass boost, high-
frequency boost, etc). Submit plots to show your test signals to demonstrate the
equalizer performance.
(b) Find out if introduction of small relative delays in the four subbands prior to
reconstruction affects your perception of the audio (i.e. determine to what extent
differential phase shifts or delays are important in perception of speech or music).
Show any tests conducted, describe the audible results and any conclusions you
find.
4. Part D: MULTI-CHANNEL FIR FILTER-BANK IN TWO DIMENSIONS
Extending what you did in Part B, you are to implement a perfect reconstruction filter-
bank (PR-FB) using Matlab, and apply it to images. You can use Matlab routines
such as firpr2chfb and mfilt.firdecim, etc., for this purpose. Image Processing and
related toolbox functions in Matlab may be useful (e.g. imread, imshow, mat2gray,
hist, imhist, etc.)
(a) Design a one-dimensional 2-channel PR-FB. This can be applied for separable
(rows and columns) sub-band analysis/synthesis of two-dimensional images. For
image processing, strict spatial frequency separation may not be as critical as in
other applications. Experiment with a small filter order (between 6 and 12) and
a longer one. Use a reasonable choice for filter band-edge. Your design will yield
the analysis and synthesis filters H0, H1, G0, and G1. (You might want to first
test the filter bank on some simple one-dimensional test signal.)
(b) You will now use a grayscale 8-bit, 512x512 image to test image sub-band de-
composition. A couple of possible test images (man.gif, owl.gif) are posted
on the course calendar; any other reasonable test image can be used. Apply your
2-channel analysis filter bank of part (a) to your test image(s), to get decompo-
sition into (256x256) sub-band components (Low-Low or LL, Low-High, High-
Low, and High-High). The image filtering can be implemented as separable row-
column filtering operations. Test for exact reconstruction when synthesizing the
image back from these four sub-bands.
(c) Perform reconstruction or synthesis as above, but this time with all pixels of
the LH, HL, and HH sub-band images set to 0. Comment on the nature of the
reconstruction you see.
(d) Now instead of using single zero levels as in (c) for all pixels of the LH, HL,
and HH sub-band images, experiment with less severe compression by using one
bit (two levels) per pixel quantization for these three sub-band images, and also
with three level (and, if you want, four level or 2-bit) per pixel quantization. To
4
ESE531 Spring 2022
design reasonable quantization schemes (levels and thresholds) you may consider
histograms of pixel values for the sub-bands.
(e) Do a further decomposition of the Low-Low (LL) image obtained in part (b) by
applying the same 2-channel analysis filter bank to it. (This corresponds for 1-
D signals to octave- band filtering into 3 sub-bands). Now apply considerations
similar to those of parts (c) and (d) to see if reasonable reconstructions can be
obtained with simple quantization. Note: There can be different delays or shifts
for different sub-band octave components.
essay、essay代写