-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
44 lines (28 loc) · 1000 Bytes
/
main.cpp
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
39
40
41
42
43
44
#include "savgol.hpp"
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
int main( )
{
// comment PR01
using namespace filter;
std::ofstream file;
std::vector<float> data{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
std::vector<float> gauss;
std::vector<float> savgolOrder2;
std::vector<float> average;
const int windowSize = 5;
savgol(data.begin(), data.end(), std::back_inserter(gauss), SmoothGaussian(windowSize));
savgol(data.begin(), data.end(), std::back_inserter(savgolOrder2), SmoothQuadCubic(windowSize));
savgol(data.begin(), data.end(), std::back_inserter(average), SmoothAverage(windowSize));
file.open("savgol_demo.dat");
int i = 0;
for (auto e : data)
{
file << e << " " << average[i] << " " << gauss[i] << " " << savgolOrder2[i] << "\n";
++i;
}
file.close();
return 0;
}