Programming trick: FFT normalization in Matlab and Python Numeric

A tricky issue, let me take a note here so I don't have to redo it again and again.

The Matlab and Python Numeric normalization of fft is such that the discrete version of Parseval's theorem,

sum(signal .* signal) = sum(fourier .* conj(fourier))

is satisfied by

fourier = fft(signal) / sqrt(length(signal))

On the other hand, if we require the continuous version of Parseval's theorem,

int_0ˆT |signal|ˆ2 dt = int_{-infty}ˆ{+infty} |fourier|ˆ2 df
sum(signal .* signal) * dt = sum(fourier .* conj(fourier)) * (1/T)

we need to set

fourier = fft(signal) * dt

where of course T = dt * length(signal).

Jan 25, 2005

fft (/progtricks)
2005-01-25, 14:16 [edit]


  Login:   Password:   [rss] [cc] [w3] [css]

© M. Vallisneri 2012 — last modified on 2010/01/29

Tantum in modicis, quantum in maximis