Spike
Loading...
Searching...
No Matches
CosineSignal.h
Go to the documentation of this file.
1
5#ifndef SPIKE_COSINESIGNAL_H
6#define SPIKE_COSINESIGNAL_H
7
8#include <ostream>
9#include <string>
10
11#include "Spike/Signal/Signal.h"
12
13namespace Spike {
14
18class CosineSignal : public Signal {
19private:
20 double alpha;
21 double f;
22
23public:
30 CosineSignal(double alpha, double f, const TimeFrame &time_frame);
31
37 CosineSignal(const std::string &input_file, const TimeFrame &time_frame);
38
42 void calculate_signal();
43
49 [[nodiscard]] double signal(double t) const;
50
55 [[nodiscard]] double get_f() const { return this->f; };
56
61 void print(std::ostream &out) const override {
62 out << "CosineSignal(alpha: " << alpha << ", f: " << f << ")";
63 }
64};
65
66} // namespace Spike
67
68#endif // SPIKE_COSINESIGNAL_H
Implements a cosine signal, i.e. alpha*cos(2*pi*f*t)
Definition CosineSignal.h:18
double get_f() const
Returns the frequency.
Definition CosineSignal.h:55
CosineSignal(double alpha, double f, const TimeFrame &time_frame)
Construct CosineSignal from parameters.
Definition CosineSignal.cpp:13
double signal(double t) const
Returns signal at time t, i.e. alpha*cos(2*pi*f*t)
Definition CosineSignal.cpp:45
void calculate_signal()
Calculates the cosine signal, i.e. alpha*cos(2*pi*f*t).
Definition CosineSignal.cpp:38
void print(std::ostream &out) const override
Prints cosine signal to out stream.
Definition CosineSignal.h:61
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