Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: FFT function isn't working on signals greater than a second
Replies: 2   Last Post: Mar 23, 2013 5:32 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Greg Heath

Posts: 5,949
Registered: 12/7/04
Re: FFT function isn't working on signals greater than a second
Posted: Mar 23, 2013 5:32 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

sal22 <sal22@please_post_to_group.com> wrote in message <Nvb3t.38741$lR.27224@en-nntp-16.dc1.easynews.com>...
> Greetings All
>
> I have an fft function in matlab/octave that works great on an imported mono wav/audio signal that is 1 second long, but when the signal imported is more than 1 second the frequency values become incorrect. To check this I created a 2 second signal using audacity the first half of the 2 second signal (1 second of it) was 500hz at 0.3 amplitude and the second half of the 2 second signal (1 second of it) was 200hz at 0.8 amplitude. I also checked it with audacity's analyse spectrum option.
>
> When I use the function on this 2 second signal it shows that the max frequency is at 999.95hz when it should show the max frequency is at 200hz. Can anyone help me get this function to work with signals greater than just 1 second.


dt = 1/Fs
T = N*dt
t = dt*(0:N-1);
t = 0:dt:T-dt;
tmax = T- dt

df = 1/T
df = Fs/N
f = df*(0:N-1);
f = 0:df:Fs-df;
fmax = Fs-df

If you increase the length of the time signal with data or zeropadding, dt and Fs remain constant while N, T and tmax are changed to M, Tm = M*dt and tmax = Tm-dt
= (M-1)*dt.

Correspondingly

dfm = 1/Tm
dfm = Fs/M
fm = dfm*(0:M-1);
fm =0:dfm:Fs-dfm
fmmax = Fs-dfm

Therefore the maximum frequency is not significantly changed. Only the spacing is decreased df --> dfm = (N/M)*df.

> % This is an evenly spaced frequency vector with NumUniquePts points.
> freq_vect = (0:NumUniquePts-1)*vp_sig_len/nfft;


df = vp_sig_len/nfft is incorrect.

Hope this helps.

Greg



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.