.Modelica.Math.FastFourierTransform.realFFTwriteToFile

Information

Syntax

success = realFFTwriteToFile(t_computed, fileName, f_max, amplitudes, phases, format);

Description

This functions stores the result of an FFT computation on file, so that it can be easily plotted. amplitudes and phases are the vectors that hold the amplitudes and phases values of an FFT computation. If the size of the phases vector is zero, no phases will be stored on file. Otherwise, phases must have the same dimension as the amplitudes vector. The frequency vector f is constructed within the function from the dimension of the amplitudes vector and the information that amplitudes[end] is at frequency f_max. The format argument defines the file format (for details see writeRealMatrix). Argument t_computed is the actual time instant when the FFT was computed. It is used in the print message after the result was stored on file.

The matrix on file has the following structure:

Example

See detailed example model: Examples.RealFFT1.

See also

realFFTinfo, realFFTsamplePoints, realFFT

Interface

function realFFTwriteToFile
  extends Modelica.Icons.Function;
  import Modelica.Utilities.Streams.print;
  import Modelica.SIunits.Conversions.to_deg;
  import Modelica.Utilities.Streams.writeRealMatrix;
  input Real t_computed "Time instant at which the FFT was computed";
  input String fileName "File where FFT shall be stored (if it exists, it is deleted and then re-created)";
  input Modelica.SIunits.Frequency f_max "Maximum frequency";
  input Real amplitudes[:] "Amplitudes of FFT";
  input Real phases[:] = fill(0.0, 0) "Phases of FFT (either provide no argument, or a vector with the same length as amplitudes)";
  input String format = "4" "MATLAB MAT-file version: \"4\" -> v4, \"6\" -> v6, \"7\" -> v7" annotation(
    choices(choice = "4" "MATLAB v4 MAT-file", choice = "6" "MATLAB v6 MAT-file", choice = "7" "MATLAB v7 MAT-file"));
  output Boolean success "true if successful";
end realFFTwriteToFile;

Generated at 2020-06-05T07:38:22Z by OpenModelica 1.16.0~dev-420-gc007a39