How to compute Discrete Fourier Transform?

jamesvphan

I've been trying to find some places to help me better understand DFT and how to compute it but to no avail. So I need help understanding DFT and it's computation of complex numbers.

Basically, I'm just looking for examples on how to compute DFT with an explanation on how it was computed because in the end, I'm looking to create an algorithm to compute it.

Spektre

I assume 1D DFT/IDFT ...

All DFT's use this formula:

DFT equation

  • X(k) is transformed sample value (complex domain)
  • x(n) is input data sample value (real or complex domain)
  • N is number of samples/values in your dataset

This whole thing is usually multiplied by normalization constant c. As you can see for single value you need N computations so for all samples it is O(N^2) which is slow.

Here mine Real<->Complex domain DFT/IDFT in C++ you can find also hints on how to compute 2D transform with 1D transforms and how to compute N-point DCT,IDCT by N-point DFT,IDFT there.

Fast algorithms

There are fast algorithms out there based on splitting this equation to odd and even parts of the sum separately (which gives 2x N/2 sums) which is also O(N) per single value, but the 2 halves are the same equations +/- some constant tweak. So one half can be computed from the first one directly. This leads to O(N/2) per single value. if you apply this recursively then you get O(log(N)) per single value. So the whole thing became O(N.log(N)) which is awesome but also adds this restrictions:

All DFFT's need the input dataset is of size equal to power of two !!!

So it can be recursively split. Zero padding to nearest bigger power of 2 is used for invalid dataset sizes (in audio tech sometimes even phase shift). Look here:

Complex numbers

  • c = a + i*b
  • c is complex number
  • a is its real part (Re)
  • b is its imaginary part (Im)
  • i*i=-1 is imaginary unit

so the computation is like this

addition:

c0+c1=(a0+i.b0)+(a1+i.b1)=(a0+a1)+i.(b0+b1)

multiplication:

c0*c1=(a0+i.b0)*(a1+i.b1)
     =a0.a1+i.a0.b1+i.b0.a1+i.i.b0.b1
     =(a0.a1-b0.b1)+i.(a0.b1+b0.a1)

polar form

a = r.cos(θ)
b = r.sin(θ)
r = sqrt(a.a + b.b)
θ = atan2(b,a)
a+i.b = r|θ

sqrt

sqrt(r|θ) = (+/-)sqrt(r)|(θ/2)
sqrt(r.(cos(θ)+i.sin(θ))) = (+/-)sqrt(r).(cos(θ/2)+i.sin(θ/2))

real -> complex conversion:

complex = real+i.0

[notes]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Shift theorem in Discrete Fourier Transform

From Dev

Find High Frequencies with Discrete Fourier Transform [OpenCV]

From Dev

Discrete Fourier transform giving incorrect results

From Dev

Finding the Discrete Fourier Transform of a 64 * 64 image

From Dev

Discrete Fourier Transform implementation gives different result than OpenCV DFT

From Dev

What is OpenCV's Discrete Fourier Transform real output formula?

From Dev

Issues Translating Custom Discrete Fourier Transform from MATLAB to Python

From Dev

2D Discrete Fourier Transform implementation in MATLAB

From Dev

Discrete fourier transform giving complex conjugate of "right" answer

From Dev

Discrete Fourier Transform C++ - What to do next?

From Dev

2D Discrete Fourier Transform implementation in MATLAB

From Dev

Inverse discrete Fourier transform of across specified dimension in Python/Numpy

From Dev

Matlab/Octave 2D Discrete Fourier Transform

From Dev

Why are negative frequencies of a discrete fourier transform appear where high frequencies are supposed to be?

From Dev

How to represent the magnitude of a Fourier transform of an image in 8-bit format?

From Dev

How to apply Fourier transform to extract the frequency of only certain edges in an image?

From Dev

How to Fourier transform an Interferogramm to an IR Spectrum using R?

From Dev

how can i perform 3d Fourier Transform......?

From Dev

how can i perform 3d Fourier Transform......?

From Dev

How to apply Fourier transform to extract the frequency of only certain edges in an image?

From Dev

Fourier Transform in Python

From Dev

Fourier Transform with Matlab

From Dev

Fourier transform of multiple rows

From Dev

Fourier Transform and Image Compression

From Dev

Fourier transform for fiber alignment

From Dev

Fast Fourier Transform in Python

From Dev

Fourier transform for fiber alignment

From Dev

How to compute the frame of a UIView before the transform?

From Dev

How can I define the period before fitting a Fourier series to discrete data using MATLAB?

Related Related

  1. 1

    Shift theorem in Discrete Fourier Transform

  2. 2

    Find High Frequencies with Discrete Fourier Transform [OpenCV]

  3. 3

    Discrete Fourier transform giving incorrect results

  4. 4

    Finding the Discrete Fourier Transform of a 64 * 64 image

  5. 5

    Discrete Fourier Transform implementation gives different result than OpenCV DFT

  6. 6

    What is OpenCV's Discrete Fourier Transform real output formula?

  7. 7

    Issues Translating Custom Discrete Fourier Transform from MATLAB to Python

  8. 8

    2D Discrete Fourier Transform implementation in MATLAB

  9. 9

    Discrete fourier transform giving complex conjugate of "right" answer

  10. 10

    Discrete Fourier Transform C++ - What to do next?

  11. 11

    2D Discrete Fourier Transform implementation in MATLAB

  12. 12

    Inverse discrete Fourier transform of across specified dimension in Python/Numpy

  13. 13

    Matlab/Octave 2D Discrete Fourier Transform

  14. 14

    Why are negative frequencies of a discrete fourier transform appear where high frequencies are supposed to be?

  15. 15

    How to represent the magnitude of a Fourier transform of an image in 8-bit format?

  16. 16

    How to apply Fourier transform to extract the frequency of only certain edges in an image?

  17. 17

    How to Fourier transform an Interferogramm to an IR Spectrum using R?

  18. 18

    how can i perform 3d Fourier Transform......?

  19. 19

    how can i perform 3d Fourier Transform......?

  20. 20

    How to apply Fourier transform to extract the frequency of only certain edges in an image?

  21. 21

    Fourier Transform in Python

  22. 22

    Fourier Transform with Matlab

  23. 23

    Fourier transform of multiple rows

  24. 24

    Fourier Transform and Image Compression

  25. 25

    Fourier transform for fiber alignment

  26. 26

    Fast Fourier Transform in Python

  27. 27

    Fourier transform for fiber alignment

  28. 28

    How to compute the frame of a UIView before the transform?

  29. 29

    How can I define the period before fitting a Fourier series to discrete data using MATLAB?

HotTag

Archive