visualiser la moyenne des dernieres mesures

This commit is contained in:
tth 2019-01-17 09:35:48 +01:00
parent abdfc44cbe
commit fd4da38f2a
2 changed files with 37 additions and 3 deletions

View File

@ -2,16 +2,30 @@
BEGIN { BEGIN {
flag_debut = 1; flag_debut = 1;
lastminute = 0;
cumul = 0.0;
compte = 0;
} }
# iterate over all the input lines
{ {
if (flag_debut) { if (flag_debut) {
debut = $1 debut = $1
flag_debut = 0 flag_debut = 0
} }
minutes = ($1-debut) / 60; minutes = int(($1-debut) / 60);
val = ($2 + $3 + $4 + $5) / 4.0; if (minutes == lastminute) {
val = ($2 + $3 + $4 + $5);
cumul += val;
compte += 4;
}
else {
val = cumul /compte;
print minutes, val; print minutes, val;
lastminute = minutes;
cumul = 0;
compte = 0;
}
} }

20
viz/gnuplot/plot-one.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
INFILE="../../serial/foo.dat"
NBLINES=2000
TMPFILE="/tmp/dd2data.$$"
IMAGE="average4v.png"
tail -${NBLINES} ${INFILE} | ./average4v.awk > ${TMPFILE}
gnuplot << __EOC__
set term png size 800,600
set output "${IMAGE}"
set grid
set title "Average4v"
set xlabel "minutes"
set ylabel "température"
set yrange [ 5.0 : 30.0]
plot "${TMPFILE}" with lines
__EOC__