|
From: Leo B. <l_b...@us...> - 2013-11-30 20:15:07
|
> Date: Sat, 30 Nov 2013 09:28:09 -0800 > From: Vesnog <ong...@gm...> > > Greetings, > > My purpose is to plot x vs. summed y values over a certain x interval. How > can I do so? Later I will calculate the mean, variance and median of the > data from this plot. I think it should be possible in Gnuplot someway. Any > help and suggestion is welcome and appreciated. How about: total=0; ssq=0; sum=0; stat(y) = (total=total+1, ssq=y**2+ssq, sum=y+sum); mean(x) = sum/(1.0*total); mlvar(x) = ssq/(1.0*total) - mean(1)**2; plot [0:5] '-' using 1:(stat($2)) notitle 0 0 1 1 2 2 3 3 4 4 e The plot command loops over the data set, and stat computes the total number of data points, and running sum and sum of squares; it returns the running sum. mean and mlvar do what they say they do. Leo > > P.S: I have a RNG and the random numbers generated are given as an argument > to Gaussian PDF, my aim is to find the mean, variance and median from this > accumulated data. |