How to calculate the Standard Deviation of a column inside gnuplot

Bruce_Warrior picture Bruce_Warrior · Sep 15, 2011 · Viewed 11.7k times · Source

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?

Answer

Tobias Südkamp picture Tobias Südkamp · Jul 8, 2015

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