v2.0.0
Loading...
Searching...
No Matches
welch_psd.h
Go to the documentation of this file.
1//=============================================================================================================
26
27#ifndef WELCH_PSD_H
28#define WELCH_PSD_H
29
30//=============================================================================================================
31// INCLUDES
32//=============================================================================================================
33
34#include "dsp_global.h"
35
36//=============================================================================================================
37// EIGEN INCLUDES
38//=============================================================================================================
39
40#include <Eigen/Core>
41
42//=============================================================================================================
43// DEFINE NAMESPACE UTILSLIB
44//=============================================================================================================
45
46namespace UTILSLIB
47{
48
49//=============================================================================================================
57{
58 Eigen::MatrixXd matPsd;
59 Eigen::RowVectorXd vecFreqs;
60};
61
62//=============================================================================================================
78{
79public:
81 enum WindowType { Hann=0, Hamming=1, Blackman=2, FlatTop=3 };
82
83 //=========================================================================================================
95 static WelchPsdResult compute(const Eigen::MatrixXd& matData,
96 double dSFreq,
97 int iNfft = 256,
98 double dOverlap = 0.5,
99 WindowType window = Hann,
100 const Eigen::RowVectorXi& vecPicks = Eigen::RowVectorXi());
101
102 //=========================================================================================================
113 static Eigen::RowVectorXd computeVector(const Eigen::RowVectorXd& vecData,
114 double dSFreq,
115 int iNfft = 256,
116 double dOverlap = 0.5,
117 WindowType window = Hann);
118
119 //=========================================================================================================
127 static Eigen::RowVectorXd freqAxis(int iNfft, double dSFreq);
128
129private:
130 static Eigen::VectorXd buildWindow(int iN, WindowType window);
131};
132
133} // namespace UTILSLIB
134
135#endif // WELCH_PSD_H
Export/import macros and namespace declaration for the DSP library.
#define DSPSHARED_EXPORT
Definition dsp_global.h:50
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Result of a Welch PSD computation.
Definition welch_psd.h:57
Eigen::MatrixXd matPsd
n_channels × (iNfft/2+1); one-sided PSD in unit²/Hz
Definition welch_psd.h:58
Eigen::RowVectorXd vecFreqs
Frequency axis in Hz, length iNfft/2+1.
Definition welch_psd.h:59
Welch's averaged-periodogram power spectral density estimator.
Definition welch_psd.h:78