[ubuntu-uk] Curve-fitting program or package (a gnuplot example)

Robin Menneer robinmenneer at gmail.com
Sat Feb 24 19:31:28 GMT 2007


On 2/24/07, Andrew Price <andy at andrewprice.me.uk> wrote:
>
> On 24/02/07 17:54, Robin Menneer wrote:
> > I have a problem with fitting a curve to some data and would like help
> > please.  The data are:
> > x=375, 375, 375, 355, 315, 268,195, 110, 0
> > y=2500, 2150, 1920, 1600, 1250, 936, 624, 312, 0
> > I need a program that will draw a line of best fit (for me to print)
> > according to different parameters,, especially log and power and find
> the
> > best for me, and give me the equation for it.
>
> gnuplot seems like a good tool for this job. It's a tool with a wide
> range of options and commands so it can seem a bit daunting to use it
> for the first time (I should know, I used it for the first time today :))
>
> Anyway, here's an example of how to do it (I'm assuming you've already
> installed the gnuplot package):
>
> Put your X and Y data in a text file in columns like:
>
> 375    2500
> 375    2150
> 375    1920
> 355    1600
> 315    1250
> 268    936
> 195    624
> 110    312
> 0      0
>
> Then open a terminal and go to the directory with the data file in it
> and run gnuplot:
>
> $ cd /path/tomy/datafile/dir/
> $ gnuplot
>
> Once you're in the gnuplot "shell", tell it to plot columns 1 and 2 as x
> and y respectively, giving the curve a title:
>
> gnuplot> plot "mydatafile.dat" using 1:2 title 'Data' smooth csplines
>
> Removing "smooth csplines" would make gnuplot plot each individual point
> without a curve, replacing "csplines" with "unique" joins the dots. A
> whole range more options can be found in the documentation [1].
>
> If you want to plot the data to an image file, precede the plot command
> with something like these two commands:
>
> gnuplot> set terminal png
> gnuplot> set output 'mygraph.png'
>
> For a list of other output file types, just type 'set terminal' without
> an option.
>
> (Don't let the command line nature of this daunt you, it's pretty simple
> and tutorials like [2] and demos like [3] show you how powerful it can be)
>
> [1] http://www.gnuplot.info/docs/gnuplot.html
> [2] http://www.duke.edu/~hpgavin/gnuplot.html
> [3] http://www.gnuplot.info/demo/simple.html
>
> Hope this helps.
>
> --
> Andy Price
> IRC: welshbyte
> http://andrewprice.me.uk


Thanks - it does look daunting and I'll need a quiet afternoon  (or day ?)
to puzzle my way through it.  Many Thanks
Robin

--
> ubuntu-uk at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
> https://wiki.kubuntu.org/UKTeam/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-uk/attachments/20070224/82863db4/attachment-0001.htm 


More information about the ubuntu-uk mailing list