Skip to main content

Spectrogram

Namespace: UTILSLIB  ·  Library: Utilities Library

#include <utils/spectrogram.h>

class UTILSLIB::Spectrogram

Computes time-frequency spectrograms via short-time Fourier transform with configurable window and overlap.

src/examples/ex_dsp_spectral/main.cpp
const MatrixXd spectrogram = Spectrogram::makeSpectrogram(signal.transpose(), 64); // frequency bins x samples

Static Methods​

makeSpectrogram(signal, windowSize)​

Calculates the spectrogram (tf-representation) of a given signal.

Parameters:

  • signal : Eigen::VectorXd input-signal to calculate spectrogram of.

  • windowSize : qint32 size of the window which is used (resolution in time an frequency is depending on it).

Returns:

  • Eigen::MatrixXd — spectrogram-matrix (tf-representation of the input signal).

Example​

Used in examples​

ex_disp​

Disp library widgets: image map, line plot and time-frequency plot of raw data.

src/examples/ex_disp/main.cpp, line 216
//ToDo: Debug tfplot
//tf plot example
dataCol = data.row(0).transpose();
MatrixXd dataSpectrum = Spectrogram::makeSpectrogram(dataCol, raw.info.sfreq * 0.2);

ex_tf_plot​

Read data and perform tf analysis.

src/examples/ex_tf_plot/main.cpp, line 78
//tf plot
VectorXd dataCol = p_FiffEvoked.data.row(83).transpose();
MatrixXd dataSpectrum = Spectrogram::makeSpectrogram(dataCol, p_FiffEvoked.info.sfreq * 0.1);

Authors of this file​