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 //=========================================================================================================
98 static WelchPsdResult compute(const Eigen::MatrixXd& matData,
99 double dSFreq,
100 int iNfft = 256,
101 double dOverlap = 0.5,
102 WindowType window = Hann,
103 const Eigen::RowVectorXi& vecPicks = Eigen::RowVectorXi());
104
105 //=========================================================================================================
116 static Eigen::RowVectorXd computeVector(const Eigen::RowVectorXd& vecData,
117 double dSFreq,
118 int iNfft = 256,
119 double dOverlap = 0.5,
120 WindowType window = Hann);
121
122 //=========================================================================================================
130 static Eigen::RowVectorXd freqAxis(int iNfft, double dSFreq);
131
132private:
133 static Eigen::VectorXd buildWindow(int iN, WindowType window);
134};
135
136} // namespace UTILSLIB
137
138#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