Stochastic Loading Module
window.h
1 #ifndef _WINDOW_H_
2 #define _WINDOW_H_
3 
4 #define _USE_MATH_DEFINES
5 #include <cmath>
6 #include <functional>
7 #include <tuple>
8 #include <vector>
9 #include <Eigen/Dense>
10 
14 namespace signal_processing {
15 
22 std::function<Eigen::VectorXd(unsigned int)> hann_window =
23  [](unsigned int window_length) -> Eigen::VectorXd {
24  Eigen::VectorXd hann(window_length);
25  double number_of_points = static_cast<double>(window_length - 1);
26 
27  for (unsigned int i = 0; i < hann.size(); ++i) {
28  hann[i] = 0.5 * (1.0 - std::cos(2.0 * M_PI * i / number_of_points));
29  }
30 
31  return hann;
32 };
33 } // namespace signal_processing
34 
35 #endif // _WINDOW_H_
std::function< Eigen::VectorXd(unsigned int)> hann_window
Definition: window.h:22