realFFTwriteToFile

Write real FFT computation to file

Information

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

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:

  • First column: Equidistant frequency vector f in Hz from 0 Hz ... f_max Hz.
  • Second column: Amplitudes[:]
  • Optional third column: Phases[:]

Example

See detailed example model: Examples.RealFFT1.

See also

realFFTinfo, realFFTsamplePoints, realFFT

Syntax

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

Inputs (6)

t_computed

Type: Real

Description: Time instant at which the FFT was computed

fileName

Type: String

Description: File where FFT shall be stored (if it exists, it is deleted and then re-created)

f_max

Type: Frequency (Hz)

Description: Maximum frequency

amplitudes

Type: Real[:]

Description: Amplitudes of FFT

phases

Default Value: fill(0.0, 0)

Type: Real[:]

Description: Phases of FFT (either provide no argument, or a vector with the same length as amplitudes)

format

Default Value: "4"

Type: String

Description: MATLAB MAT-file version: "4" -> v4, "6" -> v6, "7" -> v7

Outputs (1)

success

Type: Boolean

Description: = true, if successful