1#ifndef SPIKE_WHITENOISESIGNAL_H
2#define SPIKE_WHITENOISESIGNAL_H
10#include "Spike/TimeFrame/TimeFrame.h"
24 std::random_device rd;
25 std::mt19937 generator;
26 std::normal_distribution<double> dist;
28 std::vector<std::complex<double>>
59 [[nodiscard]]
double signal(
double t)
const;
65 void set_alpha(
double alpha_new) { alpha = alpha_new; };
71 [[nodiscard]]
const std::vector<double> &
get_values()
const {
79 [[nodiscard]]
const std::vector<std::complex<double>> &
88 [[nodiscard]]
double get_alpha()
const {
return alpha; };
95 return 2. * (f_high - f_low) * alpha;
102 void print(std::ostream &out)
const override {
103 out <<
"WhiteNoiseSignal(alpha: " << alpha <<
", f_low: " << f_low
104 <<
", f_high: " << f_high <<
")";
An abstract base class for signals.
Definition Signal.h:20
const TimeFrame & time_frame
reference to time frame
Definition Signal.h:22
std::vector< double > signal_values
array containing the signal values
Definition Signal.h:23
A time frame with discrete time steps.
Definition TimeFrame.h:13
Implements a band limited white gaussian noise get_value.
Definition WhiteNoiseSignal.h:18
const std::vector< double > & get_values() const
Returns the white noise signal vector.
Definition WhiteNoiseSignal.h:71
double get_variance() const
Returns the variance.
Definition WhiteNoiseSignal.h:94
double signal(double t) const
Return get_value, i.e. white noise at time t.
Definition WhiteNoiseSignal.cpp:89
double get_alpha() const
Returns the amplitude.
Definition WhiteNoiseSignal.h:88
WhiteNoiseSignal(double alpha, double f_low, double f_high, const TimeFrame &time_frame)
Construct WhiteNoiseSignal from parameters.
Definition WhiteNoiseSignal.cpp:17
void set_alpha(double alpha_new)
Sets the amplitude for the white noise signal.
Definition WhiteNoiseSignal.h:65
void calculate_signal()
Generate the white noise, i.e. fill the signal_values.
Definition WhiteNoiseSignal.cpp:46
const std::vector< std::complex< double > > & get_frequencies() const
Returns the frequencies.
Definition WhiteNoiseSignal.h:80
void print(std::ostream &out) const override
Prints white noise signal to out stream.
Definition WhiteNoiseSignal.h:102