How to calculate 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 that gnuplot refers to a column using n $ n, but how can I (could serve a function) add all the values ​​of $ n. That is all I cannot do in gnuplot, and they do not want to use any external program. And since gnuplot uses the notation $ n, I think it is possible, but not so. Any suggestions?

+4
source share
3 answers

Listen to some tricks, gnuplot can do this kind of work. I talked about "Statistical Analysis Using gnuplot" on two of my blogs. The mean, maximum, minimum, standard deviation are covered. Here is the url:

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

Maybe you can find what you want from these two articles!

enter image description here

+5
source

there is a command for this: stats

example of using the entire 2nd column:

stats "filename" using 2 name "A" 

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

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

see also help stats for more information on the command

+5
source

AFAIK gnuplot cannot manipulate full column data. There are various ways to process row data, for example, adding them, etc., but this does not apply to column data.

But there are two ways in which I can think of how you can get the standard deviation:

  • Do you use an external program or export your data in a different way (that is, if you have influence on the export algorithm
  • You are using an awk type external program inside gnuplot. Some examples of this approach are described here .
-1
source

All Articles