Questions tagged [fft]

FFT is short for fast Fourier transform, any of a set of algorithms for quickly computing the discrete Fourier transform (DFT).

The FFT finds a lot of application in data analysis, particularly time-series and image data, and particularly when the data has a periodic nature, or at least a periodic component. The FFT also finds application in digital filtering. There are many FFT algorithms; they all calculate the Discrete Fourier Transform in O(n log n) operations, while the naive DFT implementation is O(n^2).

Mathematically, the Fourier Transform fits a set of sinusoids to the input data - revealing relative strengths of periodic components of the signal. The fit is optimal in a least-squared error sense. In the case of the Discrete Fourier Transform, the sinusoids are periodically related.

Related topics include DFT, signal processing, convolution, and window functions.

More information on FFT can be found in the Wikipedia article on FFT.

4796 questions
157
votes
9 answers

Peak-finding algorithm for Python/SciPy

I can write something myself by finding zero-crossings of the first derivative or something, but it seems like a common-enough function to be included in standard libraries. Anyone know of one? My particular application is a 2D array, but usually…
endolith
  • 21,410
  • 30
  • 114
  • 183
155
votes
5 answers

How do I obtain the frequencies of each value in an FFT?

I have an FFT result. These are stored in two double arrays: a real part array and an imaginary part array. How do I determine the frequencies that correspond to each element in these arrays? In other words, I would like have create an array that…
Rango
  • 1,706
  • 3
  • 13
  • 13
110
votes
4 answers

Analyze audio using Fast Fourier Transform

I am trying to create a graphical spectrum analyzer in python. I am currently reading 1024 bytes of a 16 bit dual channel 44,100 Hz sample rate audio stream and averaging the amplitude of the 2 channels together. So now I have an array of 256…
user19745
  • 3,139
  • 8
  • 23
  • 21
106
votes
7 answers

Plotting a fast Fourier transform in Python

I have access to NumPy and SciPy and want to create a simple FFT of a data set. I have two lists, one that is y values and the other is timestamps for those y values. What is the simplest way to feed these lists into a SciPy or NumPy method and plot…
user3123955
  • 2,299
  • 4
  • 18
  • 21
91
votes
4 answers

Understanding FFT output

I need some help understanding the output of the DFT/FFT computation. I'm an experienced software engineer and need to interpret some smartphone accelerometer readings, such as finding the principal frequencies. Unfortunately, I slept through most…
stackoverflowuser2010
  • 29,060
  • 31
  • 142
  • 184
86
votes
6 answers

Why does FFT produce complex numbers instead of real numbers?

All the FFT implementations we have come across result in complex values (with real and imaginary parts), even if the input to the algorithm was a discrete set of real numbers (integers). Is it not possible to represent frequency domain in terms of…
steve landiss
  • 1,579
  • 1
  • 15
  • 23
73
votes
9 answers

An implementation of the fast Fourier transform (FFT) in C#

Where can I find a free, very quick, and reliable implementation of FFT in C#? That can be used in a product? Or are there any restrictions?
AnnaR
  • 3,116
  • 6
  • 31
  • 38
71
votes
4 answers

Using the Apple FFT and Accelerate Framework

Has anybody used the Apple FFT for an iPhone app yet or know where I might find a sample application as to how to use it? I know that Apple has some sample code posted, but I'm not really sure how to implement it into an actual project.
Ian Oswald
  • 1,245
  • 3
  • 15
  • 27
67
votes
5 answers

Units of a Fourier Transform (FFT) when doing Spectral Analysis of a Signal

My question has to do with the physical meaning of the results of doing a spectral analysis of a signal, or of throwing the signal into an FFT and interpreting what comes out using a suitable numerical package, Specifically: take a signal, say a…
Assad Ebrahim
  • 5,768
  • 7
  • 39
  • 66
62
votes
3 answers

What is the difference between numpy.fft and scipy.fftpack?

Is the later just a synonym of the former, or are they two different implementations of FFT? Which one is better?
Charles Brunet
  • 18,389
  • 21
  • 77
  • 120
55
votes
5 answers

Reliable and fast FFT in Java

since I don't want to do it on my own, I am searching for a good FFT implementation for java. First I used this one here FFT Princeton but it uses objects and my profiler told me, that its not really fast due to this fact. So I googled again and…
InsertNickHere
  • 3,507
  • 3
  • 24
  • 23
51
votes
3 answers

PIL cannot write mode F to jpeg

I am taking a jpg image and using numpy's fft2 to create/save a new image. However it throws this error "IOError: cannot write mode F as JPEG" Is there an issue with CMYK and JPEG files in PIL??? p = Image.open('kibera.jpg') bw_p =…
JHHP
  • 511
  • 1
  • 4
  • 4
49
votes
10 answers

Invertible STFT and ISTFT in Python

Is there any general-purpose form of short-time Fourier transform with corresponding inverse transform built into SciPy or NumPy or whatever? There's the pyplot specgram function in matplotlib, which calls ax.specgram(), which calls mlab.specgram(),…
endolith
  • 21,410
  • 30
  • 114
  • 183
48
votes
4 answers

Understanding Matlab FFT example

I am new to matlab and FFT and want to understand the Matlab FFT example. For now I have two main questions: 1) Why does the x-axis (frequency) end at 500? How do I know that there aren't more frequencies or are they just ignored? 2) How do I know…
stefan.at.wpf
  • 13,061
  • 31
  • 116
  • 199
47
votes
3 answers

only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

I am implementing fft as part of my homework. My problem lies in the implemention of shuffling data elements using bit reversal. I get the following warning: DeprecationWarning: using a non-integer number instead of an integer will result in an…
MessitÖzil
  • 938
  • 3
  • 10
  • 23
1
2 3
99 100