GPLIB++
gents.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include "UniformRNG.h"
4 #include "types.h"
5 
6 using namespace std;
7 using namespace gplib;
8 
9 int main(void)
10  {
11  string outfilebase;
12  ofstream cleants, noisets, noisets2;
13  int length;
14  double noiselevel, currentvalue;
15  UniformRNG Random;
16 
17  cout << "Outfile Name Base:";
18  cin >> outfilebase;
19  cout << "Time Series Length:";
20  cin >> length;
21  cout << "Noiselevel:";
22  cin >> noiselevel;
23  cleants.open((outfilebase + ".ts").c_str());
24  noisets.open((outfilebase + ".ns").c_str());
25  noisets2.open((outfilebase + ".ns2").c_str());
26  ofstream onlynoise("noise.ts");
27  currentvalue = 0;
28  const double Period = 50;
29  const double PI = acos(-1.);
30  double noisevalue = 0;
31  for (int i = 0; i < length; ++i)
32  {
33  //currentvalue += Random.GetNumber() - 0.5;
34  //cleants << currentvalue << endl;
35  //noisets << currentvalue + (Random.GetNumber() -0.5 )* noiselevel << endl;
36  //noisets2 << currentvalue + (Random.GetNumber()-0.5) * noiselevel << endl;
37  noisevalue = (Random.GetNumber() - 0.5) * noiselevel;
38  cleants << sin(2 * PI * i / Period) << endl;
39  noisets << cos(2 * PI * i / Period) + noisevalue << endl;
40  noisets2 << cos(2 * PI * i / Period) + noisevalue << endl;
41  onlynoise << noisevalue << endl;
42  }
43  cleants.close();
44  noisets.close();
45  noisets2.close();
46  }
Generate uniformly distributed random numbers, this is basically a wrapper for the boost random numbe...
Definition: UniformRNG.h:19
int main(void)
Definition: gents.cpp:9
float GetNumber(const float low, const float high)
Return a random float between low and high.
Definition: UniformRNG.cpp:21