(info, amplitudes, phases) = rawRealFFT(u);
Raw interface to a function of the Kiss_FFT package to compute the FFT of a real, sampled signal. The input argument of this function is a Real vector u. size(u,1) must be even. An efficient computation is performed, if size(u,1) = 2^a*3^b*5^c (a,b,c Integer ≥ 0). The function computes a real FFT (Fast Fourier Transform) of u and returns the result in form of the outputs amplitudes and phases. Argument info provides additional information:
info = 0: Successful FFT computation. info = 1: size(u,1) is not even. info = 2: size(work,1) is not correct (= a protected utility array). info = 3: Another error.
Note, in the original publication about the efficient computation of FFT (Cooley and Tukey, 1965), the number of sample points must be 2^a. However, all newer FFT algorithms do not have this strong restriction and especially not the open source software KissFFT from Mark Borgerding used in this function.
(info, A, phases) = realFFT({0,0.1,0.2,0.4,0.5, 0.6})
function rawRealFFT extends Modelica.Icons.Function; input Real u[:] "Signal for which FFT shall be computed (size(nu,1) MUST be EVEN and should be an integer multiple of 2,3,5, that is size(nu,1) = 2^a*3^b*5^c, with a,b,c Integer >= 0)"; output Integer info "Information flag (0: FFT computed, 1: nu is not even, 2: nwork is wrong, 3: another error)"; output Real amplitudes[div(size(u, 1), 2) + 1] "Amplitudes of FFT"; output Real phases[div(size(u, 1), 2) + 1] "Phases of FFT"; end rawRealFFT;
Date | Description |
---|---|
Nov. 29, 2015 | Initial version implemented by Martin R. Kuhn and Martin Otter (DLR Institute of System Dynamics and Control. |