pure functionrawRealFFT
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
(info, amplitudes, phases) = rawRealFFT(u);
Description
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.
References
- Mark Borgerding (2010):
- KissFFT, version 1.3.0.
http://sourceforge.net/projects/kissfft/.
- James W. Cooley, John W. Tukey (1965):
- An algorithm for the machine calculation of complex Fourier series.
Math. Comput. 19: 297-301. doi:10.2307/2003354.
- Martin R. Kuhn, Martin Otter, Tim Giese (2015):
- Model Based Specifications in Aircraft Systems Design. Modelica 2015 Conference, Versailles, France, pp. 491-500, Sept.23-25, 2015. Download from: http://www.ep.liu.se/ecp/118/053/ecp15118491.pdf
Example
(info, A, phases) = realFFT({0,0.1,0.2,0.4,0.5, 0.6})
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| 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) |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | info | Information flag (0: FFT computed, 1: nu is not even, 2: nwork is wrong, 3: another error) | |
| Real[div(size(u, 1), 2) + 1] | amplitudes | Amplitudes of FFT | |
| Real[div(size(u, 1), 2) + 1] | phases | Phases of FFT |
Revisions
| Date | Description |
|---|---|
| Nov. 29, 2015 | Initial version implemented by Martin R. Kuhn and Martin Otter (DLR Institute of System Dynamics and Control. |