scipy.fftpack.rfft

scipy.fftpack.rfft(x, n=None, axis=-1, overwrite_x=0)[source]

Discrete Fourier transform of a real sequence.

The returned real arrays contains:

[y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2))]              if n is even
[y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2)),Im(y(n/2))]   if n is odd

where

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

Note that y(-j) == y(n-j).conjugate().

Parameters :

x : array_like, real-valued

The data to tranform.

n : int, optional

Defines the length of the Fourier transform. If n is not specified (the default) then n = x.shape[axis]. If n < x.shape[axis], x is truncated, if n > x.shape[axis], x is zero-padded.

axis : int, optional

The axis along which the transform is applied. The default is the last axis.

overwrite_x : bool, optional

If set to true, the contents of x can be overwritten. Default is False.

See also

fft, irfft, scipy.fftpack.basic

Notes

Within numerical accuracy, y == rfft(irfft(y)).

Previous topic

scipy.fftpack.ifftn

Next topic

scipy.fftpack.irfft