1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Digital Fourier Transform - create frequency axis

  1. Apr 27, 2009 #1
    1. The problem statement, all variables and given/known data
    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.

    2. Relevant 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]

    3. 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 (Text):
    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 (Text):
    x = x(1:n/2);

    I asked my teacher, and he told me it was OK, but to be honest I don't really trust him. My class mate (using the same technique) has already had his report graded, and he got a 4 out of 10, mainly because his frequency axis was apparently wrong.

    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!

    Why is my Latex not working? Even simple things such as y = x^2 don't work:
    [tex]y = x^2[/tex]

  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted