realFFTinfo(f_max, f_resolution, f_max_factor=5);
From the maximum interested frequency f_max (in [Hz]) and the frequency resolution f_resolution (in [Hz]) the function computes the key FFT data as used by the FFT blocks and prints them to the output window.
realFFTinfo(f_max=170, f_resolution=0.3)
results in the following output:
... Real FFT properties Desired: f_max = 170 Hz f_resolution = 0.3 Hz f_max_factor = 5 Calculated: Number of sample points = 5760 (= 2^7*3^2*5^1) Sampling frequency = 1728 Hz (= 0.3*5760) Sampling period = 0.000578704 s (= 1/1728) Maximum FFT frequency = 864 Hz (= 0.3*5760/2; f={0,0.3,0.6,...,864} Hz) Number of frequency points = 2881 (= 5760/2+1) Simulation time = 3.33275 s
realFFTsamplePoints, realFFT, realFFTwriteToFile
function realFFTinfo extends Modelica.Icons.Function; import Modelica.Utilities.Streams.print; input Modelica.SIunits.Frequency f_max "Maximum frequency"; input Modelica.SIunits.Frequency f_resolution "Frequency resolution"; input Integer f_max_factor(min = 1) = 5 "Maximum FFT frequency >= f_max*f_max_factor (sample frequency = 2*Maximum FFT Frequency)"; end realFFTinfo;
Date | Description |
---|---|
Nov. 29, 2015 | Initial version implemented by Martin R. Kuhn and Martin Otter (DLR Institute of System Dynamics and Control. |