- #1
eric hardin
- 6
- 0
Hello,
I have a question regarding fft's. My experience with working with Fourier transforms is pretty much limited to transforming contrived functions pen and paper style, not dft's. But now I need something and I think the fft is the appropriate tool, but I'm having a hard time understanding some aspects of it. I figured I could get some help here... please be gentle.
I'm using numpy, I think it's a lot like matlab, so you should be able to read it if you know matlab.
My question deals with reading the normalized frequency axis. I think I understand that I can directly read the frequency from a plot but in units of cycles per sample. But I feel like I'm missing something that I need to pull out the real frequency if I don't know the sampling frequency.
So, of course, I started out with simple examples like a sinusoid according to some tutorials:
n=arange(0,30,1)
fs = 10
x=cos(2*pi*n/fs)
N1=2**8
X1 = abs(fft(x,N1))
F1 = linspace(0,N1-1,N1)/N1
pylab.plot(F1,X1)
And I see a spike at 0.1 and 0.9 corresponding to the frequencies 1 and -1 in units of 1/fs. But what I don't understand is how to pull out that frequency if I don't know fs, which is the sampling frequency, correct? For example, how would you find the frequency if I gave you x without telling you how I generated the data?
Also, what if the signal looks like,
x=cos(2*pi*n/2)+cos(2*pi*n/10).
Those are different sampling frequencies, so to which does the normalized frequency axis correspond.
Sorry if this is an elementary question, but I feel like I've looked around enough to warrant asking people.
As always, because I don't understand the material, I probably gave the wrong details. Please let me know if more information is needed.
My eternal gratitude,
Eric Hardin
I have a question regarding fft's. My experience with working with Fourier transforms is pretty much limited to transforming contrived functions pen and paper style, not dft's. But now I need something and I think the fft is the appropriate tool, but I'm having a hard time understanding some aspects of it. I figured I could get some help here... please be gentle.
I'm using numpy, I think it's a lot like matlab, so you should be able to read it if you know matlab.
My question deals with reading the normalized frequency axis. I think I understand that I can directly read the frequency from a plot but in units of cycles per sample. But I feel like I'm missing something that I need to pull out the real frequency if I don't know the sampling frequency.
So, of course, I started out with simple examples like a sinusoid according to some tutorials:
n=arange(0,30,1)
fs = 10
x=cos(2*pi*n/fs)
N1=2**8
X1 = abs(fft(x,N1))
F1 = linspace(0,N1-1,N1)/N1
pylab.plot(F1,X1)
And I see a spike at 0.1 and 0.9 corresponding to the frequencies 1 and -1 in units of 1/fs. But what I don't understand is how to pull out that frequency if I don't know fs, which is the sampling frequency, correct? For example, how would you find the frequency if I gave you x without telling you how I generated the data?
Also, what if the signal looks like,
x=cos(2*pi*n/2)+cos(2*pi*n/10).
Those are different sampling frequencies, so to which does the normalized frequency axis correspond.
Sorry if this is an elementary question, but I feel like I've looked around enough to warrant asking people.
As always, because I don't understand the material, I probably gave the wrong details. Please let me know if more information is needed.
My eternal gratitude,
Eric Hardin