0% found this document useful (0 votes)
90 views

EEE 5502 Code 5: 1 Problem

This homework assignment involves analyzing and filtering chirp signals using the short-time Fourier transform (STFT). Two filters are designed using the windowing method and applied to a chirp signal. The filters are also concatenated and applied. Systems that modify the STFT across frequency and time domains are implemented on music signals to experiment with different effects.

Uploaded by

Michael Olvera
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

EEE 5502 Code 5: 1 Problem

This homework assignment involves analyzing and filtering chirp signals using the short-time Fourier transform (STFT). Two filters are designed using the windowing method and applied to a chirp signal. The filters are also concatenated and applied. Systems that modify the STFT across frequency and time domains are implemented on music signals to experiment with different effects.

Uploaded by

Michael Olvera
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

EEE 5502 Code 5

Michael Olvera
November 2019

1 Problem
How many hours did you spend on this homework? 10 hours

2 Problem
Consider a chirp signal (slightly different from the prior assignment):
2πn2
 
x[n] = cos (1)
100000
Included with this assignment is a [y, xSTFT, ySTFT] = stft func(x, W) function to com- pute the STFT of
an input signal x with window size W. The function outputs of a modified signal (y – we will use in the next
question), the STFT of x (xSTFT), and the STFT output of y (ySTFT).
For this question, assume x[n] has length N = 25000, assume a sampling rate of Fs = 10, 000 Hz, and use an
STFT window of WST F T = 50. Furthermore, consider two ideal filter impulse responses:
h1 [n] = cos((π/4)n) + cos((π/2)n)
(2)
h2 [n] = cos((π/2)n) + cos((3π/4)n)
Throughout this problem, use the sampling frequency to plot the STFT and magnitude response dimensions
with time in seconds and/or frequency in Hertz. Always label your axes.
1. Submit a plot of the magnitude of the STFT of x[n].

2. Use the windowing method to design a length W causal, approximate FIR filters for h1[n] and h2[n]. Use
a Hann window, defined by
1
w[n] = [1 − cos(2πn/W )] (u[n] − u[n − W ] (3)
2

1
with lengths W1 = 50, W2 = 10 for h1[n] and h2[n], respectively. Refer to the approximate FIR filters as
g1[n] and g2[n]. Submit a plot of the magnitude response for each filter.

3. Apply each filter (g1[n] and g2[n]) to x[n]. Refer to the outputs as z1[n] and z2[n]. Submit a plot of the
magnitude of STFT of z1[n] and z2[n].

2
4. Use soundsc to listen to x[n], z1[n], and z3[n]. What do the filters do?
The w1[n] filter acts as a passband filter and removes a significant amount of the frequencies while the
w2[n] filter removes very few high frequencies.

5. Repeat parts (b)-(d) with a rectangular window rather than a Hann window. Provide all of the requested
plots.

3
4
6. Based on your result, how does the choice of window affect the filter output?
Depending on what window you use, you can tune the frequencies allowed in the output. For instance,
the Hanning window removes a greater portion of the higher frequencies than what a rectangular window
would.
7. Build a new filter g3[n] by concatenating g1[n] and g2[n] with the code:

g3 = [g2; zeros(7000, 1); g1; ] (4)

Note that this assumes f1 and f2 are column vectors. Apply g3[n] to x[n]. Refer to the result as z3[n].
Submit a plot of the magnitude of STFT of z3[n].

5
8. Use soundsc to listen to z3[n]. Explain why the STFT looks and audio sounds as it does.
Since we concatenated both of these two different filters, what will happen is the signal when convoluted
with the the concatenated signal will produce two different modified chirp signals but played back to back.

3 Problem
In early classes, filtering is often used to “denoise” data. This assumes the noise is in a particular frequency
band. Yet, this is typically false. The STFT allows us to overcome this assumption and allows us to create some
other interesting effects. Let X[m,k] represent the STFT of some signal x[n] across discrete time / frames m and
discrete frequencies k. Consider the following systems:

1. As previously mentioned, the STFT func function computes the STFT of x[n], modifies the STFT (or will
after this assignment – currently it does nothing), and then computes the inverse STFT to get an output
y[n]. Modify the STFT func by implementing system 1 at these lines (this may require more than one line
of code):

2. Load chiptune noise.wav. Implement system 1 across the frequency domain for each frame. Plot the
magnitude of the STFT for the original music signal and the modified music signal. Use axis to zoom-in
on same relevant (i.e., non-zero) information for each part.

6
3. Listen to the result with soundsc. Based on the audio and STFT, what does system 1 do?
System 1 removes the noise that appears near the end of the song and makes the song much deeper and

7
lower.
4. Now modify the STFT func by implementing system 2 at the previous lines (this may require more than
one line of code). Again, use a window of size WSTFT = 1000.

5. Load chiptune nonoise.wav. Implement system 2 across the time domain. Plot the magnitude of the STFT
for the original music signal and the modified music signal. Use axis to zoom-in on same relevant (i.e.,
non-zero) information for each part.

6. Listen to the result with soundsc. Based on the audio and STFT, what does system 2 do?

You might also like