Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.fft.rfft

numpy.fft.rfft(a,n=None,axis=-1,norm=None)[source]

Compute the one-dimensional discrete Fourier Transform for real input.

This function computes the one-dimensionaln-point discrete FourierTransform (DFT) of a real-valued array by means of an efficient algorithmcalled the Fast Fourier Transform (FFT).

Parameters:
a:array_like

Input array

n:int, optional

Number of points along transformation axis in the input to use.Ifn is smaller than the length of the input, the input is cropped.If it is larger, the input is padded with zeros. Ifn is not given,the length of the input along the axis specified byaxis is used.

axis:int, optional

Axis over which to compute the FFT. If not given, the last axis isused.

norm:{None, “ortho”}, optional

New in version 1.10.0.

Normalization mode (seenumpy.fft). Default is None.

Returns:
out:complex ndarray

The truncated or zero-padded input, transformed along the axisindicated byaxis, or the last one ifaxis is not specified.Ifn is even, the length of the transformed axis is(n/2)+1.Ifn is odd, the length is(n+1)/2.

Raises:
IndexError

Ifaxis is larger than the last axis ofa.

See also

numpy.fft
For definition of the DFT and conventions used.
irfft
The inverse ofrfft.
fft
The one-dimensional FFT of general (complex) input.
fftn
Then-dimensional FFT.
rfftn
Then-dimensional FFT of real input.

Notes

When the DFT is computed for purely real input, the output isHermitian-symmetric, i.e. the negative frequency terms are just the complexconjugates of the corresponding positive-frequency terms, and thenegative-frequency terms are therefore redundant. This function does notcompute the negative frequency terms, and the length of the transformedaxis of the output is thereforen//2+1.

WhenA=rfft(a) and fs is the sampling frequency,A[0] containsthe zero-frequency term 0*fs, which is real due to Hermitian symmetry.

Ifn is even,A[-1] contains the term representing both positiveand negative Nyquist frequency (+fs/2 and -fs/2), and must also be purelyreal. Ifn is odd, there is no term at fs/2;A[-1] containsthe largest positive frequency (fs/2*(n-1)/n), and is complex in thegeneral case.

If the inputa contains an imaginary part, it is silently discarded.

Examples

>>>np.fft.fft([0,1,0,0])array([ 1.+0.j,  0.-1.j, -1.+0.j,  0.+1.j])>>>np.fft.rfft([0,1,0,0])array([ 1.+0.j,  0.-1.j, -1.+0.j])

Notice how the final element of thefft output is the complex conjugateof the second element, for real input. Forrfft, this symmetry isexploited to compute only the non-negative frequency terms.

Previous topic

numpy.fft.ifftn

Next topic

numpy.fft.irfft

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp