Wednesday, September 14, 2011

Statistic analysis using gnuplot (0)

I will talk about statistic analysis using gnuplot in this article. The following contents are covered---maximum, minimum, mean value, standard deviation.

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
to plot the mean value. Here constant-value is an arbitrary constant and $n is the column which contains the random data. Note that there is only one point plotted using the above command, so plot style line can not be used. To plot the the mean value using a line we may need to use xerrobars plot style. (Next time I will give a method to plot it using plot style line.)
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.
rand_t.dat can be downloaded here. Picture statistic.png is shown below.
Statistic analysis using gnuplot--maximum,minimum and mean value

5 comments:

  1. If you are looking for your desired job So visit now our website Rozgar Ki Dunya . You can find all information about education and jobs on our website. If you want to start your business then Government announced Kamyab Jawan Program SchemeGet Loan and start your own business.
    PPSC announced 145 plus vacancies in different departments. click on PPSC jobs October 2019 Advertisement 36/2019 and download advertisement
    click on PPSC jobs October 2019 Advertisement 36/2019 and download advertisement
    You can also check CTI New 4500 Jobs In Punjab 2019-20 For Lecturer Male & Female
    For Free internship Check here: Pakistan Post Internship Program 2019-35000+ Interns
    If you want get online earning training free then visit: E-Rozgar Traning program 2019-Earn up to Rs.80,000//= per month

    ReplyDelete

  2. Most automatic transmissions even have associate oil coolers, so check the hoses and contours for leaks. A shredded CV boot can cause associate unsuccessful CV joint and CV shaft. And if you are performing on a [*fr1] shaft, confirm to ascertain the hub bearing for any play during which the hub nut is torqued properly. A sloppy higher ball joint or lower ball joint can chomp your tires, or maybe produce your 2011 ford f250 front drive shaft 1/2 Ton - Pickup additional sturdy to manage. U-joints got to be cozy, and there mustn't be any signs of a leak around the differential cowl.. ford f250 front drive shaft .

    ReplyDelete

  3. The Asigo System Review- Read It Before You Buy - Kingss Lyn
    The Asigo system review explains how Chris munch asigo system review has jotted down a step by step
    training to help internet marketers get fast results His.Staregies Work!

    For More Information Visit https://kingsslyn.com/the-asigo-system-review/ Here .

    ReplyDelete

Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.