Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
FFT function isn't working on signals greater than a second
Replies:
2
Last Post:
Mar 23, 2013 5:32 AM




Re: FFT function isn't working on signals greater than a second
Posted:
Mar 23, 2013 5:32 AM


sal22 <sal22@please_post_to_group.com> wrote in message <Nvb3t.38741$lR.27224@ennntp16.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:N1); t = 0:dt:Tdt; tmax = T dt
df = 1/T df = Fs/N f = df*(0:N1); f = 0:df:Fsdf; fmax = Fsdf
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 = Tmdt = (M1)*dt.
Correspondingly
dfm = 1/Tm dfm = Fs/M fm = dfm*(0:M1); fm =0:dfm:Fsdfm fmmax = Fsdfm
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:NumUniquePts1)*vp_sig_len/nfft;
df = vp_sig_len/nfft is incorrect.
Hope this helps.
Greg



