15.12.2012 Views

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SciPy Reference Guide, Release 0.8.dev<br />

See Also:<br />

ifft<br />

Inverse FFT<br />

rfft<br />

FFT of a real sequence<br />

Notes<br />

with the elements:<br />

[y(0),y(1),..,y(n/2-1),y(-n/2),...,y(-1)] if n is even [y(0),y(1),..,y((n-1)/2),y(-(n-<br />

1)/2),...,y(-1)] if n is odd<br />

where<br />

y(j) = sum[k=0..n-1] x[k] * exp(-sqrt(-1)*j*k* 2*pi/n), j = 0..n-1<br />

Note that y(-j) = y(n-j).conjugate().<br />

The packing of the result is “standard”: If A = fft(a, n), then A[0] contains the zero-frequency term, A[1:n/2+1]<br />

contains the positive-frequency terms, and A[n/2+1:] contains the negative-frequency terms, in order of decreasingly<br />

negative frequency. So for an 8-point transform, the frequencies of the result are [ 0, 1, 2, 3, 4, -3, -2,<br />

-1].<br />

This is most efficient for n a power of two.<br />

Examples<br />

>>> x = np.arange(5)<br />

>>> np.all(np.abs(x-fft(ifft(x)) y<br />

Return inverse discrete Fourier transform of arbitrary type sequence x.<br />

The returned complex array contains<br />

[y(0),y(1),...,y(n-1)]<br />

where<br />

y(j) = 1/n sum[k=0..n-1] x[k] * exp(sqrt(-1)*j*k* 2*pi/n)<br />

Optional input: see fft.__doc__<br />

fftn(x, shape=None, axes=None, overwrite_x=0)<br />

fftn(x, shape=None, axes=None, overwrite_x=0) -> y<br />

Return multi-dimensional discrete Fourier transform of arbitrary type sequence x.<br />

The returned array contains<br />

y[j_1,..,j_d] = sum[k_1=0..n_1-1, ..., k_d=0..n_d-1]<br />

x[k_1,..,k_d] * prod[i=1..d] exp(-sqrt(-1)*2*pi/n_i * j_i * k_i)<br />

where d = len(x.shape) and n = x.shape. Note that y[..., -j_i, ...] = y[..., n_i-j_i, ...].conjugate().<br />

Optional input:<br />

shape<br />

Defines the shape of the Fourier transform. If shape is not specified then<br />

168 Chapter 3. Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!