forked from glidernet/diy-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slope_test.cc
52 lines (40 loc) · 1.1 KB
/
slope_test.cc
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
45
46
47
48
49
50
51
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include "slope.h"
SlopePipe<int32_t> Slope;
int main(int argc, char *argv[])
{
Slope.Input(10);
Slope.Input(20);
Slope.Input(30);
Slope.Input(40);
Slope.CalcSlope();
Slope.CalcNoise();
printf("Aver=%+5.1f, Slope=%+5.1f, Noise=%4.2f\n",
0.25*Slope.Aver, 0.25*Slope.Slope, sqrt(0.0625*Slope.Noise));
Slope.Input(50);
Slope.Input(40);
Slope.Input(30);
Slope.Input(20);
Slope.CalcSlope();
Slope.CalcNoise();
printf("Aver=%+5.1f, Slope=%+5.1f, Noise=%4.2f\n",
0.25*Slope.Aver, 0.25*Slope.Slope, sqrt(0.0625*Slope.Noise));
Slope.Input(10);
Slope.Input(20);
Slope.Input(10);
Slope.Input(20);
Slope.CalcSlope();
Slope.CalcNoise();
printf("Aver=%+5.1f, Slope=%+5.1f, Noise=%4.2f\n",
0.25*Slope.Aver, 0.25*Slope.Slope, sqrt(0.0625*Slope.Noise));
Slope.Input(40);
Slope.Input(30);
Slope.Input(40);
Slope.Input(30);
Slope.CalcSlope();
Slope.CalcNoise();
printf("Aver=%+5.1f, Slope=%+5.1f, Noise=%4.2f\n",
0.25*Slope.Aver, 0.25*Slope.Slope, sqrt(0.0625*Slope.Noise));
return 0; }