Package Modelica.​Math.​FastFourierTransform.​Internal
Internal library that should not be used directly by a user

Information

This icon shall be used for a package that contains internal classes not to be directly utilized by a user.

Extends from Modelica.​Icons.​InternalPackage (Icon for an internal package (indicating that the package should not be directly utilized by user)).

Package Contents

NameDescription
prime235FactorizationFactorization of an integer in prime numbers 2,3,5
rawRealFFTCompute raw Fast Fourier Transform for real signal vector

Function Modelica.​Math.​FastFourierTransform.​Internal.​rawRealFFT
Compute raw Fast Fourier Transform for real signal vector

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})

Extends from Modelica.​Icons.​Function (Icon for functions).

Inputs

TypeNameDescription
Realu[:]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

TypeNameDescription
IntegerinfoInformation flag (0: FFT computed, 1: nu is not even, 2: nwork is wrong, 3: another error)
Realamplitudes[div(size(u, 1), 2) + 1]Amplitudes of FFT
Realphases[div(size(u, 1), 2) + 1]Phases of FFT

Function Modelica.​Math.​FastFourierTransform.​Internal.​prime235Factorization
Factorization of an integer in prime numbers 2,3,5

Information

Syntax

(success, e2, e3, e5) = prime235Factorization(n);

Description

Compute the factorization of input Integer n in prime numbers 2, 3, and 5. If this is possible, success = true and e2 is the number of prime numbers2, e3 the number of prime numbers 3 and e5 the number of prime numbers 5. If this is not possible, success = false, and e2, e3, e5 are dummy values.

Example

(success, e2, e3, e5) = prime235Factorization(60)   // success=true, e2=2, e3=1, e5=1 (= 2^2*3^1*5^1)
(success, e2, e3, e5) = prime235Factorization(7)    // success=false

Extends from Modelica.​Icons.​Function (Icon for functions).

Inputs

TypeNameDescription
Integern 

Outputs

TypeNameDescription
Booleansuccess= true, if factorization in 2,3,5 is possible
Integere2n = 2^e2*3^e3*5^e5
Integere3n = 2^e2*3^e3*5^e5
Integere5n = 2^e2*3^e3*5^e5