# Re: processing data for gnuplot

On Wed, Dec 17, 2003 at 07:47:22AM -0700, Paul E Condon wrote:
> On Wed, Dec 17, 2003 at 01:57:22PM +0100, David Fokkema wrote:
> > Hi group,
> >
> > I was not entirely sure what to put in the subject line...
> >
> > I did a very simple physics experiment involving two strings, two
> > weights and one pulley. I'll spare you the details, but by varying one
> > of the two masses, I measured the angle one of the strings made with the
> > vertical. I got these results:
> >
> > # m2 alpha
> > 0 0
> > 10 12
> > 20 23
> > 30 32
> > 15 18
> > 25 27
> > 12 14
> > 22 24
> > 27 29
> > 17 20
> >
> > where the first column is the mass of the second weight and alpha is the
> > angle, in which I made an error of ±1 degree. So far, so good.
> >
> > Now, I want to plot in gnuplot the following: m2 along the x-axis, but
> > the tangent of alpha with errorbars along the y-axis. So, I have to
> > process this data somewhat further to obtain a second data file with
> > three columns: m2, tan alpha-low, tan alpha-high.
> >
> > Of course, I could use gnumeric or something like that, but I'm
> > wondering if there are command-line tools out there that could do the
> > job. Or should I use a scripting language? perl? awk? bc? Efficiency is
> > not the problem here, ease of use is.
> >
>
> The command-line tool to use is awk. e.g.
>
> awk ' {print $1, $2-D, $2+D;} ' infile >outfile
>
> where D is the deviation in alpha. D can be computed by a subroutine
> function, but I don't have enough info to write plausible example code.
Thanks! I'll use awk.
David
--
Hi! I'm a .signature virus. Copy me into
your ~/.signature to help me spread!

**Reply to:**