realFFTsamplePoints

Return number of sample points for a real FFT

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

ns = realFFTsamplePoints(f_max, f_resolution, f_max_factor=5);

Description

From the maximum interested frequency f_max (in [Hz]) and the frequency resolution f_resolution (in [Hz]) the function computes the number of sample points ns that is as small as possible and fulfills the following criteria:

  • Maximum FFT frequency ≥ f_max_factor*f_max (= the largest frequency value of the frequency vector).
  • Frequency axis resolution is f_resolution.
  • The number of sample points is expressed as 2^a*3^b*5^c (and a,b,c are appropriate Integers).
  • The number of sample points is even.

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

ns = realFFTinfo(f_max=170, f_resolution=0.3)

results in the following output:

ns = 5760

See also

realFFTinfo, realFFT, realFFTwriteToFile

Syntax

ns = realFFTsamplePoints(f_max, f_resolution, f_max_factor)

Inputs (3)

f_max

Type: Frequency (Hz)

Description: Maximum frequency of interest

f_resolution

Type: Frequency (Hz)

Description: Frequency resolution

f_max_factor

Default Value: 5

Type: Integer

Description: Maximum FFT frequency >= f_max*f_max_factor (sample frequency = 2*Maximum FFT Frequency)

Outputs (1)

ns

Type: Integer

Description: Number of sample points that can be expressed as ns = 2^i*3^j*5^k and ns is even