Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate the Standard Deviation of a column inside gnuplot

Hello I want to know how I can calculate the standard deviation of a column of a data file using gnuplot. I know gnuplot to refer to a column using n $ n, but how do I (could serve a function) to add all values ​​of $ n. That's all I can't do in gnuplot and they do not want to have to use some external program. And since gnuplot uses the notation $ n, I guess that this is possible, but not how. Any suggestions?

like image 833
Bruce_Warrior Avatar asked Sep 15 '11 16:09

Bruce_Warrior


2 Answers

there is a command for that: stats

example for using the whole 2nd column:

stats "filename" using 2 name "A"

this gives you detailed information in the terminal and you can use the data with the suffix (here "A") like:

plot "filename" t "data", A_mean t "mean value"

see also help stats for more information on the command

like image 149
Tobias Südkamp Avatar answered Nov 14 '22 12:11

Tobias Südkamp


Play some tricks, gnuplot can do this kind of work. I have talked about "Statistic analysis using gnuplot" in two of my blog articles. The mean value, maximum, minimum, standard deviation are all covered. Here is the urls:

http://gnuplot-surprising.blogspot.com/2011/09/statistic-analysis-using-gnuplot-0.html

http://gnuplot-surprising.blogspot.com/2011/09/statistic-analysis-using-gnuplot-1.html

May be you can find what you want from these two articles!

enter image description here

like image 45
hsxz Avatar answered Nov 14 '22 11:11

hsxz