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