saveFFTonFile impure function

Requirements.ChecksInFixedWindow_withFFT.Internal.saveFFTonFile  · source

Icon of saveFFTonFile

Save FFT computation on file

Extends Modelica.Icons.Function

Stores the amplitudes A of one FFT computation in the MATLAB file resultDirectory/filePrefix<fileIndex>.mat as matrix FFT and prints the file name. The directory is created if needed and an existing file of the same name is removed first. Each amplitude A[i] at frequency f = f_max*(i-1)/(size(A,1)-1) is written as the three rows [f,0; f,A[i]; f,0], so that plotting column 2 over column 1 shows the spectrum as vertical lines. Nothing is stored if iTick ≤ 1. Called by PartialFFT after every FFT when storeFFTonFile = true.

Revisions

DateDescription
Nov. 29, 2015Initial version implemented by Martin R. Kuhn and Martin Otter (DLR Institute of System Dynamics and Control)
The research leading to these results has received funding from the European Union’s Seventh Framework Programme (FP7/2007-2016) for the Clean Sky Joint Technology Initiative under grant agreement no. CSJU-GAM-SGO-2008-001.

Inputs

NameTypeDescription
resultDirectory inputStringDirectory where results shall be stored
filePrefix inputStringFirst part of file name (= FFT.<instanceName>.)
fileIndex inputIntegerIndex of FFT computation
f_max inputSI.FrequencyMaximum frequency
A[…] inputRealAmplitude
iTick inputIntegerNumber of stored sample points (nothing is stored if iTick <= 1)