Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #931

gaussians as plotting style

From Martin Keiter <Martin.Keiter_NOSPAM@gmx.de>
Newsgroups comp.graphics.apps.gnuplot
Subject gaussians as plotting style
Date 2012-02-10 14:40 +0000
Message-ID <slrnjjab2i.f4h.Martin.Keiter_NOSPAM@egg38.theochem.uni-duesseldorf.de> (permalink)

Show all headers | View raw


Hi,

background: I'm doing theoretical calculations of absorption spectra.
The results are sharp lines (energy vs. absorption strength).
Experimental data does in many cases not have sharp lines, but broader
absorption. many small absortions in a small energy range may add up to
a bigger absorption band.
In order to better compare with experiment, I want to have broadened
lines.

I have a file with x0/i value pairs in every line.
for every pair of x0/i I want to plot i * exp(-(x0-x)**2)

And then I want to have a sum of all these plots (as in "smooth
frequency")

I have tried

filename = "1a"
lines = system(sprintf("wc --lines %s | sed 's/ .*//'", filename))
plot for [line=1:lines] (\
x0 = system(sprintf("awk '{if (NR==%d) print $%d;}' < %s " , line, 1, filename)),\
 i = system(sprintf("awk '{if (NR==%d) print $%d;}' < %s " , line, 2, filename)),\
i* exp(-(x-x0)**2) )

but this is incredibly slow for a data file with 5 lines:
1 1.1
2 2.2
3 3.3
4 4.4
5 5.5

And it looks incredibly ugly!

can it be done in a more clever way? Best thing wohl be if gnuplot would
accept a user defined function for the style, but I think that's not
possible...?




Back to comp.graphics.apps.gnuplot | Previous | NextNext in thread | Find similar


Thread

gaussians as plotting style Martin Keiter <Martin.Keiter_NOSPAM@gmx.de> - 2012-02-10 14:40 +0000
  Re: gaussians as plotting style sfeam <sfeam@users.sourceforge.net> - 2012-02-10 08:07 -0800
  Re: gaussians as plotting style Péter Juhász <peter.juhasz83@gmail.com> - 2012-02-10 08:28 -0800
    Re: gaussians as plotting style Martin Keiter <Martin.Keiter_NOSPAM@gmx.de> - 2012-02-13 10:34 +0000

csiph-web