Beruflich Dokumente
Kultur Dokumente
Assignment 1
In Assignment 1, animal sounds in .wav format are read and their time-domain
waveforms are plotted directly from the data, along with their frequency
spectrum. The discrete-time Fourier transform (DTFT) is used to find the
frequency spectrum of each animal sound, which is possible because the sounds
are discrete in the time-domain while being continuous in frequency using the
built-in MATLAB function freqz(), as detailed in the provided Lab 4 specifications
(Lab4.pdf).
Table 1. Animal sounds table
Name
Fs
cat.wav
bird.wav
toad.wav
tiger.wav
whale.wav
22050
22050
22255
22255
16000
Length
(sec)
1.00
1.14
0.67
0.753
3.45
Length
(Samples)
22052
25197
14843
16763
55190
Using the max() built-in function, the fundamental frequency (first peak of the
magnitude response) of the cat sound occurs at occurs at 733 Hz (0.209 rad).
The precise amplitude value of the fundamental frequency is 379.79. These
values are confirmed by the bottom two graphs of Figure 1.
Figure 1. Cat sound: time sequence, DTFT (rad), and DTFT (Hz)
Figure 2. Bird sound: time sequence, DTFT (rad), and DTFT (Hz)
Figure 3. Toad sound: time sequence, DTFT (rad), and DTFT (Hz)
Figure 4. Tiger sound: time sequence, DTFT (rad), and DTFT (Hz)
Figure 5. Whale sound: time sequence, DTFT (rad), and DTFT (Hz)
Assignment 2
Using a given file with Microsoft Stock prices over time, convolution is performed
using the MATLAB built-in filter() function. The following given moving-average
filter is used to smooth the stock:
The original stock and the resultant smooth filtered stock are both shown in the
top plot in Figure 6. The frequency spectrum of h[n] is shown by the DTFT
magnitude in the bottom plot in Figure 6, which is.
The moving average filter makes the stocks look smoother because it is a LPF
see how in the DTFT, the majority of the signal power is preserved near
baseband frequency, but higher frequencies are filtered out. So that is why using
this LPF has smoothed out the high-frequency micro-fluctuations in stock
prices.
Assignment 3
Assignment 3 implements a digital graphic equalizer on a given music.wav file,
and the role of dB magnitude to characterize gain and using freqz() with sampling
rate as input is observed.
If stereo (two channel) sound lasts for 10 seconds, the number of samples one
would expect to see is 882,000, as calculated using the following formula:
Filter coefficients
Filter 1
Filter 2
Filter 3
B1 = 0.0495 0.1486
A1 = 1.0000 -1.1619
B2 = 0.1311
0
A2 = 1.0000 -0.4824
B3 = 0.0985 -0.2956
A3 = 1.0000 0.5722
0.1486 0.0495
0.6959 -0.1378
-0.2622
0
0.8101 -0.2269
0.2956 -0.0985
0.4218 0.0563
LP, HP,
or BP?
LP
0.1311
0.2722
BP
HP
While performing subband filtering, the three filters gains are changed to G1 =
0.1, G2 = 0.1, and G3 = 10. This means that the 1st and 2nd filters are attenuated
as much as possible (-20 dB) for a typical equalizer while the 3rd filter is boosted
to the max (+20 dB) for a typical equalizer. As expected, these new weights for
each filter make the song sound much more tinny and lacking bass tones a lot
like a cheap and/or small speaker sounds.
The gain of each filter is defined by the following formula: