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//=============================================================================================================
59{
60 Eigen::MatrixXd matPsd;
61 Eigen::RowVectorXd vecFreqs;
62};
63
64//=============================================================================================================
75{
76public:
79 {
80 Hann = 0,
84 };
85
86 //=========================================================================================================
99 static WelchPsdResult compute(const Eigen::MatrixXd& matData,
100 double dSFreq,
101 int iNfft = 256,
102 double dOverlap = 0.5,
103 WindowType window = Hann,
104 const Eigen::RowVectorXi& vecPicks = Eigen::RowVectorXi(),
105 bool bRemoveDc = true);
106
107 //=========================================================================================================
119 static Eigen::RowVectorXd computeVector(const Eigen::RowVectorXd& vecData,
120 double dSFreq,
121 int iNfft = 256,
122 double dOverlap = 0.5,
123 WindowType window = Hann,
124 bool bRemoveDc = true);
125
126 //=========================================================================================================
134 static Eigen::RowVectorXd freqAxis(int iNfft, double dSFreq);
135
136private:
137 static Eigen::VectorXd buildWindow(int iN, WindowType window);
138};
139
140} // namespace UTILSLIB
141
142#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:59
Eigen::MatrixXd matPsd
n_channels × (iNfft/2+1); one-sided PSD in unit²/Hz
Definition welch_psd.h:60
Eigen::RowVectorXd vecFreqs
Frequency axis in Hz, length iNfft/2+1.
Definition welch_psd.h:61
Welch's averaged-periodogram power spectral density estimator.
Definition welch_psd.h:75