Spike
Loading...
Searching...
No Matches
TwoCosineSignal.h
1#ifndef SPIKE_TWOCOSINESIGNAL_H
2#define SPIKE_TWOCOSINESIGNAL_H
3
4#include <string>
5
7
8namespace Spike {
9
16class TwoCosineSignal : public Signal {
17private:
18 double alpha;
19 double f1;
20 double beta;
21 double f2;
22 double phi;
23
24public:
34 TwoCosineSignal(double alpha, double f1, double beta, double f2, double phi,
35 const TimeFrame &time_frame);
36
42 TwoCosineSignal(const std::string &input_file, const TimeFrame &time_frame);
43
47 void calculate_signal();
48
55 [[nodiscard]] double signal(double t) const;
56
57 void print(std::ostream &out) const override {
58 out << "TwoCosineSignal(alpha: " << alpha << ", f1: " << f1
59 << ", beta: " << beta << ", f2: " << f2 << ", phi: " << phi << ")";
60 }
61};
62
63} // namespace Spike
64
65#endif // SPIKE_TWOCOSINESIGNAL_H
An abstract base class for signals.
Definition Signal.h:20
const TimeFrame & time_frame
reference to time frame
Definition Signal.h:22
A time frame with discrete time steps.
Definition TimeFrame.h:13
Implements a signal consisting of two cosine, i.e. alpha*cos(2*pi*f1*t)
Definition TwoCosineSignal.h:16
TwoCosineSignal(double alpha, double f1, double beta, double f2, double phi, const TimeFrame &time_frame)
Construct TwoCosineSignal from parameters.
Definition TwoCosineSignal.cpp:13
void print(std::ostream &out) const override
Prints the signal to out stream.
Definition TwoCosineSignal.h:57
double signal(double t) const
Returns signal, i.e. alpha*cos(2*pi*f1*t) + beta*cos(2*pi*f2*t + phi)
Definition TwoCosineSignal.cpp:51
void calculate_signal()
Calculates the cosine signal.
Definition TwoCosineSignal.cpp:43