00001
00029 #ifndef SOURCE_H
00030 #define SOURCE_H
00031
00032 #include <itpp/base/vec.h>
00033
00034
00035 namespace itpp
00036 {
00037
00039
00044 class Sine_Source
00045 {
00046 public:
00048 Sine_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0);
00050 double operator()() { return sample(); }
00052 vec operator()(int n);
00054 mat operator()(int h, int w);
00055 protected:
00056 private:
00057 double sample();
00058 double m, A, theta, dtheta;
00059 };
00060
00065 class Square_Source
00066 {
00067 public:
00069 Square_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0);
00071 double operator()() { return sample(); }
00073 vec operator()(int n);
00075 mat operator()(int h, int w);
00076 protected:
00077 private:
00078 double sample();
00079 double m, A, theta, dtheta;
00080 };
00081
00086 class Triangle_Source
00087 {
00088 public:
00090 Triangle_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0);
00092 double operator()() { return sample(); }
00094 vec operator()(int n);
00096 mat operator()(int h, int w);
00097 protected:
00098 private:
00099 double sample();
00100 double m, A, theta, dtheta;
00101 };
00102
00107 class Sawtooth_Source
00108 {
00109 public:
00111 Sawtooth_Source(double freq, double mean = 0.0, double ampl = 1.0, double inphase = 0.0);
00113 double operator()() { return sample(); }
00115 vec operator()(int n);
00117 mat operator()(int h, int w);
00118 protected:
00119 private:
00120 double sample();
00121 double m, A, theta, dtheta;
00122 };
00123
00128 class Impulse_Source
00129 {
00130 public:
00132 Impulse_Source(double freq, double ampl = 1.0, double inphase = 0.0);
00134 double operator()() { return sample(); }
00136 vec operator()(int n);
00138 mat operator()(int h, int w);
00139 protected:
00140 private:
00141 double sample();
00142 double A, pos, dtheta;
00143 };
00144
00149 class Pattern_Source
00150 {
00151 public:
00153 Pattern_Source(const vec &pattern, int start_pos = 0);
00155 virtual ~Pattern_Source() { }
00157 double operator()() { return sample(); }
00159 vec operator()(int n);
00161 mat operator()(int h, int w);
00162 protected:
00163 private:
00164 double sample();
00165 int pos;
00166 vec pat;
00167 double mean, var;
00168 };
00169
00170 }
00171
00172 #endif // #ifndef SOURCE_H