summaryrefslogtreecommitdiff
path: root/gnuplot.org
diff options
context:
space:
mode:
authorfpi2022-02-20 18:55:04 +0100
committerfpi2022-03-17 14:29:07 +0100
commit15af0dc407c2198b130fc5984467a24d6c0f3225 (patch)
tree8441f2ed9efe90c5e9807b8f548a2cfec0220b8d /gnuplot.org
parentAdd settings for printable A4 plots (diff)
Run avg init function on startup
Diffstat (limited to '')
-rw-r--r--gnuplot.org1
1 files changed, 1 insertions, 0 deletions
diff --git a/gnuplot.org b/gnuplot.org
index 782ae5d..2f8a6bf 100644
--- a/gnuplot.org
+++ b/gnuplot.org
@@ -43,6 +43,7 @@ A collection of functions that can calculate a running average.
# running averages
samples(x,n) = $0>(n-1) ? n : ($0+1)
init(x)=(back1=back2=back3=back4=back5=back6=back7=back8=back9=back10=back11=back12=sum=0)
+if(init(0)){} # what is the best way to run functions without showing output?
avg1(x)=(back1=x,back1)
avg2(x)=(back2=back1,(avg1(x)+back2)/samples($0,2))
avg3(x)=(back3=back2,(samples($0,2)*avg2(x)+back3)/samples($0,3))