这是一份宾夕法尼亚大学的ESE531课程数字信号处理作业代写的成功案例

An inversecomb filter is useful in the generation of sounds in computer music. It simulates the reflection of a traveling wave characterizing a musical instrument. The input-output relationship of the inverse comb filter is given by

$$

y(n)=x(n)+R^{L} y(n-L)

$$

for some values of $R$ and $L$.

(a) Use the MATLAB filter function to plot the system’s impulse response when $R=0.9995$ and $L=10$. Plot the impulse response $h(n)$.

(b) Calculate the magnitude response of the comb filter for $L=10$ and $R=0.9995$. Plot the magnitude and phase responses of the inverse comb filter. How many peaks occur between the radian frequencies of 0 and $\pi$ ? Use the functions filter, freqz, abs, angle.

(c) To conform to the sound production of musical instruments using the inverse comb filter, one needs to shorten the duration of the high frequency components compared to the duration of the low-frequency components. That change can be done by introducing a low-pass filter in the feedforward path resulting in the following input/output equation

$$

y(n)=0.5 R^{L} y(n-L)+0.5 R^{L} y(n-L-1)+0.5 x(n)+0.5 x(n-1)

$$

The input to generate interesting sounds (they sound like a plucked string) requires high frequency content as well as some periodicity. Generate and apply to the filter a “buzz” signal given by

$$

x(n)=\cos \left(\frac{\pi n}{32}\right) \delta_{200}(n)

$$

where $\delta_{200}(n)$ is a sequence of unit impulses occurring at $0,200,400, \ldots .$ Let $\mathrm{R}$ and $\mathrm{L}$ be the values given above. Let the sampling frequency be Fs $=2000$, and plot 8000 values of the input $x(n)$ and the output $y(n)$. What does the output sound like? Use the function sound.

In this problem we consider the ghost-effect that occurs when transmitting images. In the transmission of an image it is possible that due to multipath effects the receiver gets two (or more) copies of the image that are delayed and attenuated (a phenomena similar to echoes in audio). Digital images are two dimensional arrays, where each of the entries are called picture elements or pixels (a pixel is the average intensity in a small area of the analog image). One can transmit an image using one-dimensional methods by concatenating the rows (or columns) of the image $X(i, j)$ to form a sequence $x(n)$. Suppose that the received signal is

$$

y(n)=x(n)+\alpha x(n-\beta)

$$

that is, $x(n)$ plus a version of it attenuated and delayed. After transforming back this sequence, i.e. $y(n)$, into an image, the ghost-effect is a distortion that is easily seen.

(a) To simulate this ghost-effect in Matlab, read the image alien.jpg (use imread function). Create a matrix $X$ that contain the grayscale version of the alien image (use the function rgb2gray). Form the one-dimensional time sequence $x(n)$ by using $X(:)$ to concatenate the columns of $X$. To obtain $y(n)$, use filter, a delay of $\beta=27$ samples and attenuation factor $\alpha=-1.5$. To plot the generated ghost image, the sequence $y(n)$ is then converted into an array of the same dimensions as the grayscale image $X$, using the function reshape. For plotting the images (original and ghost images), use imagesc and right after colormap(gray) which will display the images in gray level rather than in color.

(b) To get rid of the ghost effect, the signal $y(n)$ needs to be processed by the inverse of the filter that was used to generate it from $x(n)$. What would be the inverse filter $G(z)$ be equal to? Use this filter to cancel the ghost effect on the signal $y(n)$. Plot the obtained image. How well this inverse filtering process work?

In your report, display the original, ghost, and recovered images. Comment on your results.

The computation of the FFT of a very long signal is not -in most cases- possible or meaningful. One way to do this computation -and with some significance- is to represent the signal as the addition of windowed segments and computing the FFT of each of these segments.

(a) Let the signal be $x(n), n=0, \cdots, L-1$. Segmenting it into $M$ blocks of length $N$, we have that

$$

\hat{x}(n)=\sum_{m=0}^{M-1} x_{m}(n)

$$

where $x_{m}(n)=x(n) w(n-m N)$ approximates $x(n)$ for any window $w(n)$. Show analytically that the DTFT of $\hat{x}(n)$, or $\hat{X}\left(e^{j \omega}\right)$, equals $X\left(e^{j \omega}\right)$ when the DTFT of the window $w(n)$ is $2 \pi \delta(\omega) / M$. This indicated that for the effect of windowing to be minimal, the spectrum of the window should approximate that of a delta function in the frequency.

(b) The FFT of $x(n)$ is approximately given as

$$

\chi(k)=\sum_{m=0}^{M-1} X_{m}(k)

$$

where $X_{m}(k)$ is the FFT of the windowed signal $x_{m}(n)$ as defined above. Write a MATLAB script or function to compute the FFT of a long signal by windowing it as indicated above. To test your algorithm, compute the FFT of

$$

x(n)=\cos \left(\frac{2 \pi n}{10}\right)+\cos \left(\frac{2 \pi n}{20}\right), n=0, \cdots, L-1

$$

where $L=5000$. Use FFTs of length $N=500$, a Kaiser window generated by ” $\mathrm{w}=$ kaiser( $\mathrm{N}, 3)$; w $=w^{\prime}$;” in MATLAB. Compare the magnitude of the FFT of $x(n)$, using the windowing approach, with the magnitude of the FFT (of length 5000$)$ of $x(n)$.

(c) Consider a chirp signal, which is basically a sinusoid with a time-varying frequency,

$$

x(n)=\cos \left(\frac{0.5 n^{2}}{L}\right), n=0, \cdots, L-1

$$

where $L=5000$. Plot the magnitude of the FFTs for the first and last windowed signals, $x_{0}(n)$ and $x_{M-1}(n)$. Plot the magnitude of the FFT of the signal $x(n)$ and the magnitude of the FFT of $x(n)$ expressed as a supper position of windowed signals. Let the length of the windowed signals and the length of the FFTs be $N=500$. Use a Kaiser window of length $N$ and parameter beta of 1 .

Consider the following specifications for the design of a discrete filter using the bilinear transformation method:

$\alpha\left(e^{j 0}\right)=35 d B$

$\alpha_{1}=36 \mathrm{~dB} \quad \omega_{p}=0.4 \pi$

$\alpha_{2}=65 \mathrm{~dB} \quad \omega_{s}=0.65 \pi$

(a) Find the minimum order of the Butterworth and Chebyshev low-pass discrete filters (use butterord and cheb1ord). Between the Butterworth and the Chebyshev which gives the lower order?

(b) To obtain the transfer functions of the Butterworth $\left(H_{b}(z)\right)$ and of the Chebyshev $\left(H_{c}(z)\right)$ filters use the functions butter and cheby1 (for this let $R_{p}=\alpha_{\max }$ ) Plot the poles/zeros, magnitude (linear scale) and unwrapped phases of these filters.

(c) Plot the magnitude responses in $\mathrm{dB}$ and verify that the filters satisfy the design specifications (plot lines corresponding to the loss specifications).

(d) The parameter $R_{p}$ in cheby is related to the ripples that appear in the Chebyshev filter magnitude. Decrease the value of $R_{p}$ to $0.7 \alpha_{\max }$, redesign the filter for this new value of $R_{p}$ and see that the ripples get smaller. Are the specifications satisfied with this value? Plot the magnitude response in $\mathrm{dB}$ and verify that the filter satisfies the design specifications (plot lines corresponding to the loss specifications).

# Digital Signal Processing

## Course: ESE531

**Units:** 1.0 CU**Term:** Spring 2018**When:** TR 4:30-6pm**Where:** DRLB A2**Instructor:** Tania Khanna (Moore 201Q) (seas: taniak) (office hours: W 2-4:30pm and by appointment)**TA:** Yexuan Lu (seas: yexuan) Office hours: T 6:30-8:30pm in Towne 315; Th 1:30-3:30pm in Towne 215**TA:** Linyan Dai (seas: ldai) Office Hours: W 4:30-6:30pm; F 4-6pm in TBD**Grader:** Xin Lin (seas: linxin6)

**Prerequisites:** ESE 324/224 or equivalent. Undergraduate students need permission of instructor. Roundup of topics you should be familiar with.

Quick Links: [Course Objectives] [Grading] [Policies] [Spring 2018 Calendar] [Reading] [Piazza]

**Catalog Level Description:** This course covers the fundamentals of discrete-time signals and systems and digital filters. Specific topics include discrete-time Fourier transform (DTFT); Z-transforms; frequency response of linear discrete-time systems; sampling of continuous time signals, analog to digital conversion, sampling-rate conversion; basic discrete-time filter structures and types; finite impulse response (FIR) and infinite impulse response (IIR) filters; linear phase conditions; design of FIR and IIR filters; discrete Fourier transform (DFT) and the fast Fourier transform (FFT) algorithm. Applications in filtering and spectrum estimation, image filtering, adaptive filters, equalization.

## Role and Objectives

Students will:

- Learn the fundamentals of digital signal processing
- Provide an understanding of discrete-time signals and systems and digital filters
- Enable you to apply DSP concepts to a wide range of fields
- Gain the ability to read the technical literature on DSP
- Apply the techniques learned in a final project encompassing many different application typesRough Syllabus (by weeks)IntroductionDiscrete-Time (DT) SignalsTime-Domain Analysis of DT SystemsDiscrete Fourier Transform (DFT)Fast Fourier Transform (FFT)Discrete-Time Fourier Transform (DTFT)z-TransformSampling of Continuous Time SignalsData Converters and ModulationUpsampling/DownsamplingDiscrete-Time Filter DesignSee Spring 2018 course calendar for day-by-day calendar with assignments.Main Text
- A. V. Oppenheim and R. W. Schafer (with J. R. Buck),
*Discrete-Time Signal Processing*. 3rd. Edition, Prentice-Hall, 2010

GradingGrading is based on homework assignments, final project, midterm, and final exam.- Homework Assignments [20%]
- Final Project [25%]
- Midterm [25%]
- Final [30%]

**before**the posted due date.AbsenteesUse the Penn Course Absence Report (CAR) in Penn-in-Touch to report absences.Grade AdjustmentRegrade requests must be submitted to the TA no later than 1 week after the assignment grades are released to the students. A cover sheet detailing the disrepency should be submitted with a copy of the original homework, and the TA reserves the right to regrade the entire assignment. Students are responsible for checking posted grades in a timely manner.CollaborationYou may help each other understand how to use the CETS computers and course tools.Each student is expected to do his/her own work — including developing the details, writing code, performing simulations, and writing the solutions. For the homeworks and projects, you are free to discuss basic strategies and approaches with your fellow classmates or others, but detail designs, implementations, analysis, and writeups should always be the work of the individual. If you get advice or insights from others that influenced your work in any way, please acknowledge this in your writeups.In general, you are expected to abide by Penn’s Code of Academic Integrity. If there is any uncertainty, please ask.Previous Offerings - A. V. Oppenheim and R. W. Schafer (with J. R. Buck),