v2.0.0
Loading...
Searching...
No Matches
welch_psd.h
Go to the documentation of this file.
1//=============================================================================================================
33
34#ifndef WELCH_PSD_H
35#define WELCH_PSD_H
36
37//=============================================================================================================
38// INCLUDES
39//=============================================================================================================
40
41#include "dsp_global.h"
42
43//=============================================================================================================
44// EIGEN INCLUDES
45//=============================================================================================================
46
47#include <Eigen/Core>
48
49//=============================================================================================================
50// DEFINE NAMESPACE UTILSLIB
51//=============================================================================================================
52
53namespace UTILSLIB
54{
55
56//=============================================================================================================
64{
65 Eigen::MatrixXd matPsd;
66 Eigen::RowVectorXd vecFreqs;
67};
68
69//=============================================================================================================
85{
86public:
88 enum WindowType { Hann=0, Hamming=1, Blackman=2, FlatTop=3 };
89
90 //=========================================================================================================
102 static WelchPsdResult compute(const Eigen::MatrixXd& matData,
103 double dSFreq,
104 int iNfft = 256,
105 double dOverlap = 0.5,
106 WindowType window = Hann,
107 const Eigen::RowVectorXi& vecPicks = Eigen::RowVectorXi());
108
109 //=========================================================================================================
120 static Eigen::RowVectorXd computeVector(const Eigen::RowVectorXd& vecData,
121 double dSFreq,
122 int iNfft = 256,
123 double dOverlap = 0.5,
124 WindowType window = Hann);
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
dsp library export/import macros.
#define DSPSHARED_EXPORT
Definition dsp_global.h:56
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Result of a Welch PSD computation.
Definition welch_psd.h:64
Eigen::MatrixXd matPsd
n_channels × (iNfft/2+1); one-sided PSD in unit²/Hz
Definition welch_psd.h:65
Eigen::RowVectorXd vecFreqs
Frequency axis in Hz, length iNfft/2+1.
Definition welch_psd.h:66
Welch's averaged-periodogram power spectral density estimator.
Definition welch_psd.h:85