]> git.itanic.dy.fi Git - log-plotter/blob - balancing.plot
main: Add missing EOF check to serial read
[log-plotter] / balancing.plot
1 set term png size 800,480
2
3 set datafile separator ";"
4
5 set ylabel "Voltage (mV)"
6
7 datafile = "logfile.log"
8
9 samples(x) = $0 > 4 ? 5 : ($0+1)
10 avg5(x) = (shift5(x), (back1 + back2 + back3 + back4 + back5) / samples($0))
11 shift5(x) =     (back5 = back4, \
12                  back4 = back3, \
13                  back3 = back2, \
14                  back2 = back1, \
15                  back1 = x)
16 init(x) = (back1 = back2 = back3 = back4 = back5 = sum = 0)
17
18 plot sum=init(0), \
19         datafile using (avg5($7 - ($7 + $8 + $9) / 3)), \
20         datafile using (avg5($8 - ($7 + $8 + $9) / 3)), \
21         datafile using (avg5($9 - ($7 + $8 + $9) / 3))