<br><br><div><span class="gmail_quote">On 2/24/07, <b class="gmail_sendername">Andrew Price</b> &lt;<a href="mailto:andy@andrewprice.me.uk">andy@andrewprice.me.uk</a>&gt; 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>&gt; I have a problem with fitting a curve to some data and would like help<br>&gt; please.&nbsp;&nbsp;The data are:<br>&gt; x=375, 375, 375, 355, 315, 268,195, 110, 0<br>&gt; y=2500, 2150, 1920, 1600, 1250, 936, 624, 312, 0
<br>&gt; I need a program that will draw a line of best fit (for me to print)<br>&gt; according to different parameters,, especially log and power and find the<br>&gt; best for me, and give me the equation for it.<br><br>
gnuplot seems like a good tool for this job. It&#39;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&#39;s an example of how to do it (I&#39;m assuming you&#39;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&nbsp;&nbsp;&nbsp;&nbsp;2500<br>375&nbsp;&nbsp;&nbsp;&nbsp;2150<br>
375&nbsp;&nbsp;&nbsp;&nbsp;1920<br>355&nbsp;&nbsp;&nbsp;&nbsp;1600<br>315&nbsp;&nbsp;&nbsp;&nbsp;1250<br>268&nbsp;&nbsp;&nbsp;&nbsp;936<br>195&nbsp;&nbsp;&nbsp;&nbsp;624<br>110&nbsp;&nbsp;&nbsp;&nbsp;312<br>0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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&#39;re in the gnuplot &quot;shell&quot;, tell it to plot columns 1 and 2 as x<br>and y respectively, giving the curve a title:<br><br>gnuplot&gt; plot &quot;mydatafile.dat&quot; using 1:2 title &#39;Data&#39; smooth csplines
<br><br>Removing &quot;smooth csplines&quot; would make gnuplot plot each individual point<br>without a curve, replacing &quot;csplines&quot; with &quot;unique&quot; 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&gt; set terminal png<br>gnuplot&gt; set output &#39;mygraph.png&#39;<br><br>For a list of other output file types, just type &#39;set terminal&#39; without
<br>an option.<br><br>(Don&#39;t let the command line nature of this daunt you, it&#39;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&#39;ll need a quiet afternoon&nbsp; (or day ?)&nbsp; to puzzle my way through it.&nbsp; 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>