From 15af0dc407c2198b130fc5984467a24d6c0f3225 Mon Sep 17 00:00:00 2001 From: fpi Date: Sun, 20 Feb 2022 18:55:04 +0100 Subject: Run avg init function on startup --- gnuplot.org | 1 + 1 file changed, 1 insertion(+) (limited to 'gnuplot.org') 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)) -- cgit v1.2.3