We begin with the maximum and minimum as they are the simplest. There are two gnuplot defined variables (to see all the gnuplot variables use command "show variable all"), GPVAL_DATA_Y_MAX and GPVAL_DATA_Y_MIN. They are the maximum and minmum y value in the data file which you just used to plot. So after plotting you look over the gnuplot defined variables and you find the maximum and minimum values.

The mean value is a bit difficult. There is no such a gnuplot defined value. To find it out we will play a trick. There is smooth option called "unique" which makes the data monotonic in x and points with the same x-value are replaced by a single point having the average y-value. So it is appropriate for finding the mean value. We use command

plot "data_t.dat" u (constant-value):($n) smooth unique w point

plot "data_t.dat" u (constant-value):($n):(xerrobar-length) smooth unique w xerrorbars

Now we come to plot the data points, maximum, minimum and mean value to a picture. And standard deviation is left next time.

reset plot "rand_t.dat" u 1:2 #To get the max and min value ymax=GPVAL_DATA_Y_MAX ymin=GPVAL_DATA_Y_MIN ylen=ymax-ymin xmax=GPVAL_DATA_X_MAX xmin=GPVAL_DATA_X_MIN xlen=xmax-xmin #plot set term png set output "statistic.png" set xrange [xmin:xmax] set yrange [ymin-0.5*ylen:ymax+0.5*ylen] set xlabel "time(ms)" set ylabel "Random Signal(Arbitary Unit)" plot "rand_t.dat" u 1:2 w p pt 7 ps 0.5 notitle,\ "rand_t.dat" u (xmax+0.1*xlen):($2):(1.1*xlen)\ smooth unique w xerrorbars notitle,\ ymax w l lt 3 notitle,\ ymin w l lt 3 notitle #plot raw data, mean value, maximun and minimun respectively #There is only one data point for the mean value. To make it #looks like a line, we plot it using a xerrorbars plot style.

Statistic analysis using gnuplot--maximum,minimum and mean value |

Every person has the passion in any aspects or things.

ReplyDeleteIf you love something and it came in front of you it completes your day and your mood turns into something you won't expected.

I love your work and I want to read more about it. Visit my site if you have time . Thank you.

triciajoy.com

www.triciajoy.com