- #1
Nick89
- 555
- 0
Homework Statement
Using Matlab, I need to record vowels (a, e, o, i, etc) of my voice and apply a digital Fourier transform (DFT) to the recorded sound signal.
The resulting signal should be a periodic train of 'spikes', with modulated amplitude. The modulation of the amplitude is what forms the sound; different vowels produce different amplitude modulations. The highest point of a peak in the amplitude modulation is called a formant.
I need to produce several of these DFT signals, and plot their powerspectrum ([itex]P = F F^* = |F|^2[/itex], where F is the (complex) signal) against the frequency.
To do this, I record a vowel using a samplefrequency [itex]f_s[/itex] of 11025 Hz. I record a total number of 2^14 = 16384 samples, which results in about 1.5 seconds of recording time.
Then, I calculate the DFT using the built-in "fft" Matlab function (which uses the equations below), and calculate it's powerspectrum.
I can then plot the powerspectrum against the number of samples (from n = 0 To 16384), but what I really need is a plot of the powerspectrum against the frequency.
Now, I am unsure how to convert from the number of samples to the frequency, so this is where I need your help.
Homework Equations
Matlab uses the following DFT:
[tex]X(k) = \displaystyle \sum_{n=1}^N x(n) \exp \left( \frac{-2\pi j (n-1)(k-1)}{N}\right)[/tex]
[tex]x(n) = \frac{1}{N} \sum_{k=1}^N X(k) \exp \left( \frac{2 \pi j (n-1)(k-1)}{N}\right)[/tex]
The Attempt at a Solution
Once I have the powerspectrum of a record signal, I need to plot it against the frequency [itex]f[/itex] (not angular frequency [itex]\omega[/itex]).
My reasoning was that the last sample (n = 2^14 = 16384) should correspond to the sample frequency [itex]f_s = 11025[/itex]. Therefore, I created the axis (let's call it an array [itex]x[/itex]) by first creating an array of integers 1 to 2^14. I then divide each element by 2^14, and multiply each element by the sample frequency 11025 Hz:
Code:
n = 2^14;
Fs = 11025;
x = 1:n;
x = x ./ n;
x = x .* Fs;
This results in a frequency axis ranging from 0 Hz to 11025 Hz.
Furthermore, because the powerspectrum appears to be symmetric about the center of the graph (n = 2^14 / 2 = 2^13, or at frequency 11025/2, assuming I am correct), I can discard half of the graph, so I only use the first half:
Code:
x = x(1:n/2);
So this means the way I 'define' my frequency axis is wrong?
How should I do it instead?
I was maybe thinking about the Nyquist theorem; should the last sample correspond to only half the sample frequency perhaps? Thanks for any insights!
EDIT
Why is my Latex not working? Even simple things such as y = x^2 don't work:
[tex]y = x^2[/tex]
??