-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (31 loc) · 952 Bytes
/
main.cpp
File metadata and controls
39 lines (31 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "filetxt.h"
#include "fft.h"
#include "fftfreq.h"
long long date, collectionTime;
string idSensor;
double samplingRate, inverseSamplingRate;
coordinates sensorValues;
coordinates fft_output;
int main(int argc, char** argv)
{
if (argc > 1)
{
readNameFile(argv[1],&date, &collectionTime, &idSensor);
getDataTxt(argv[1], &sensorValues);
}
else
{
cout << "Please, pass the file path." << endl;
return 0;
}
int sizeData = sensorValues.size();
double *frequencys;
frequencys = (double*)malloc(sizeof(double) * sizeData);
samplingRate = double(1000 * sizeData) / double(collectionTime);
inverseSamplingRate = double(collectionTime) / double(long long(1000) * sizeData);
fftfreq(frequencys, sizeData, inverseSamplingRate);
fft(sizeData, sensorValues, &fft_output, collectionTime);
exportData(fft_output, frequencys);
free(frequencys);
return 0;
}