fftr
Functions
-
int main(int argc, char *argv[])
fftr [ option ] [ infile ]
-l int
FFT length \((2 \le L)\)
-m int
order of sequence \((0 \le M < L)\)
-o int
output format
0
real and imaginary parts1
real part2
imaginary part3
amplitude spectrum4
power spectrum
-H
output only half part
infile str
double-type data sequence
stdout
double-type FFT sequence
The below example analyzes a sine wave using Blackman window.
sin -p 30 -l 256 | window | fftr -o 3 > sine.spec
- Parameters:
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns:
0 on success, 1 on failure.
-
class RealValuedFastFourierTransform
Calculate DFT of real-valued input data.
The input is \(M\)-th order real-valued data:
\[ \begin{array}{cccc} x(0), & x(1), & \ldots, & x(M). \end{array} \]The outputs are\[\begin{split} \begin{array}{cccc} \mathrm{Re}(X(0)), & \mathrm{Re}(X(1)), & \ldots, & \mathrm{Re}(X(L-1)), \\ \mathrm{Im}(X(0)), & \mathrm{Im}(X(1)), & \ldots, & \mathrm{Im}(X(L-1)), \end{array} \end{split}\]where \(L\) is the FFT length and must be a power of two.Public Functions
-
explicit RealValuedFastFourierTransform(int fft_length)
- Parameters:
fft_length – [in] FFT length, \(L\).
-
RealValuedFastFourierTransform(int num_order, int fft_length)
- Parameters:
num_order – [in] Order of input, \(M\).
fft_length – [in] FFT length, \(L\).
-
inline int GetNumOrder() const
- Returns:
Order of input.
-
inline int GetFftLength() const
- Returns:
FFT length.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
bool Run(const std::vector<double> &real_part_input, std::vector<double> *real_part_output, std::vector<double> *imag_part_output, RealValuedFastFourierTransform::Buffer *buffer) const
- Parameters:
real_part_input – [in] \(M\)-th order real part of input.
real_part_output – [out] \(L\)-length real part of output.
imag_part_output – [out] \(L\)-length imaginary part of output.
buffer – [out] Buffer.
- Returns:
True on success, false on failure.
-
bool Run(std::vector<double> *real_part, std::vector<double> *imag_part, RealValuedFastFourierTransform::Buffer *buffer) const
- Parameters:
real_part – [inout] Real part.
imag_part – [out] Imaginary part.
buffer – [out] Buffer.
- Returns:
True on success, false on failure.
-
class Buffer
Buffer for RealValuedFastFourierTransform class.
-
explicit RealValuedFastFourierTransform(int fft_length)
-
class RealValuedInverseFastFourierTransform
Calculate inverse DFT of real-valued input data.
This is almost similar to RealValuedFastFourierTransform. The DFT results are divided by the FFT length \(L\).
Public Functions
-
explicit RealValuedInverseFastFourierTransform(int fft_length)
- Parameters:
fft_length – [in] FFT length, \(L\).
-
RealValuedInverseFastFourierTransform(int num_order, int fft_length)
- Parameters:
num_order – [in] Order of input, \(M\).
fft_length – [in] FFT length, \(L\).
-
inline int GetNumOrder() const
- Returns:
Order of input.
-
inline int GetFftLength() const
- Returns:
FFT length.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
bool Run(const std::vector<double> &real_part_input, std::vector<double> *real_part_output, std::vector<double> *imag_part_output, RealValuedInverseFastFourierTransform::Buffer *buffer) const
- Parameters:
real_part_input – [in] \(M\)-th order real part of input.
real_part_output – [out] \(L\)-length real part of output.
imag_part_output – [out] \(L\)-length imaginary part of output.
buffer – [out] Buffer.
- Returns:
True on success, false on failure.
-
bool Run(std::vector<double> *real_part, std::vector<double> *imag_part, RealValuedInverseFastFourierTransform::Buffer *buffer) const
- Parameters:
real_part – [inout] Real part.
imag_part – [out] Imaginary part.
buffer – [out] Buffer.
- Returns:
True on success, false on failure.
-
class Buffer
Buffer for RealValuedInverseFastFourierTransform class.
-
explicit RealValuedInverseFastFourierTransform(int fft_length)