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.

5308 questions
12
votes
4 answers

Improving the speed of FFT Implementation

I'm a beginner in programming and am currently trying to work on a project requiring Fast Fourier Transform implementation. I have so far managed to implement the following: Does anyone have any alternatives and suggestions to improve the speed of…
sagarn
  • 143
  • 1
  • 1
  • 7
12
votes
2 answers

FFT coefficients question

I'm a software engineer working on DSP for the first time. I'm successfully using an FFT library that produces frequency spectrums. I also understand how the FFT works in terms of its inputs and outputs, in particular the contents of the two output…
stackoverflowuser2010
  • 38,621
  • 48
  • 169
  • 217
12
votes
2 answers

What is wrong with this fourier transform implementation

I'm trying to implement a discrete fourier transform, but it's not working. I'm probably have written a bug somewhere, but I haven't found it yet. Based on the following formula: This function does the first loop, looping over X0 - Xn-1... …
Timo Willemsen
  • 8,717
  • 9
  • 51
  • 82
12
votes
5 answers

Fourier transform of a Gaussian is not a Gaussian, but thats wrong! - Python

I am trying to utilize Numpy's fft function, however when I give the function a simple gausian function the fft of that gausian function is not a gausian, its close but its halved so that each half is at either end of the x axis. The Gaussian…
chutsu
  • 13,612
  • 19
  • 65
  • 86
12
votes
1 answer

Find most dominant audio frequency in sample

I'm trying to create a project that pulls in a live stream audio file from the internet and continuously samples the audio looking for the most dominant frequency for a given time period. The idea is that if it detects a frequency of let's say 440Hz…
Bill
  • 5,478
  • 17
  • 62
  • 95
12
votes
3 answers

How should I interpret the output of numpy.fft.rfft2?

Obviously the rfft2 function simply computes the discrete fft of the input matrix. However how do I interpret a given index of the output? Given an index of the output, which Fourier coefficient am I looking at? I am especially confused by the sizes…
dimpol
  • 545
  • 9
  • 21
12
votes
4 answers

Why do the convolution results have different lengths when performed in time domain vs in frequency domain?

I'm not a DSP expert, but I understand that there are two ways that I can apply a discrete time-domain filter to a discrete time-domain waveform. The first is to convolve them in the time domain, and the second is to take the FFT of both, multiply…
ggkmath
  • 4,188
  • 23
  • 72
  • 129
12
votes
2 answers

Why isn't this inverse Fourier transform giving the correct results?

I want to invert the Fourier transform of an image in MATLAB, but the result is not the original image (as it should be). There is obviously some implementation detail that I don't know about that's causing the issue. Here's the code: img =…
Christopher Neylan
  • 8,018
  • 3
  • 38
  • 51
12
votes
1 answer

Calculate uncertainty in FFT amplitude

My Python programming problem is the following: I want to create an array of measurement results. Each result can be described as a normal distribution for which the mean value is the measurement result itself and the standard deviation is its…
user2996448
  • 157
  • 2
  • 6
12
votes
1 answer

amplitude of numpy's fft results is to be multiplied by sampling period?

I try to validate my understanding of Numpy's FFT with an example: the Fourier transform of exp(-pi*t^2) should be exp(-pi*f^2) when no scaling is applied on the direct transform. However, I find that to obtain this result I need to multiply the…
user1163676
  • 155
  • 1
  • 1
  • 7
12
votes
7 answers

Getting starting with Parallel programming

So it looks like multicore and all its associated complications are here to stay. I am planning a software project that will definitely benefit from parallelism. The problem is that I have very little experience writing concurrent software. I…
Talesh
  • 550
  • 1
  • 5
  • 12
12
votes
3 answers

Python SciPy convolve vs fftconvolve

I know generally speaking FFT and multiplication is usually faster than direct convolve operation, when the array is relatively large. However, I'm convolving a very long signal (say 10 million points) with a very short response (say 1 thousand…
LWZ
  • 11,670
  • 22
  • 61
  • 79
11
votes
2 answers

Frequency Analysis in Python

I'm trying to use Python to retrieve the dominant frequencies of a live audio input. For the moment I am experimenting using the audio stream my Laptop's built in microphone, but when testing the following code, I am getting very poor results. #…
Dave Moore
  • 1,432
  • 4
  • 12
  • 17
11
votes
5 answers

Extremely large weighted average

I am using 64 bit matlab with 32g of RAM (just so you know). I have a file (vector) of 1.3 million numbers (integers). I want to make another vector of the same length, where each point is a weighted average of the entire first vector, weighted by…
Micah Manary
  • 217
  • 2
  • 11
11
votes
2 answers

Matlab inverse FFT from phase/magnitude only

So I have this image 'I'. I take F = fft2(I) to get the 2D fourier transform. To reconstruct it, I could go ifft2(F). The problem is, I need to reconstruct this image from only the a) magnitude, and b) phase components of F. How can I separate these…
Jordan
  • 3,998
  • 9
  • 45
  • 81