fitting
https://scienceblogs.com/
enComparison of quadratic curve fitting
https://scienceblogs.com/dotphysics/2008/09/25/comparison-of-quadratic-curve-fitting
<span>Comparison of quadratic curve fitting</span>
<div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>In a [previous post](/dotphysics/2008/09/basics-making-graphs-with-kinematics-stuff-part-ii/), I talked about how to plot kinematics data with a spread sheet and how to fit a quadratic function to the data. In the back of my head I remember "Don't trust Excel". I seem to recall someone claiming that Excel did not do a proper fit. To test this, I collected some data and used several methods to fit the data:</p>
<ul><li>MS Excel's built in function fitting</li>
<li>Using the spread sheet (Excel) to manually calculate the best fit parameters</li>
<li>Vernier's Logger Pro (version 3.6.1)</li>
<li>Plot 0.997 - <a href="http://plot.micw.eu/">http://plot.micw.eu/</a> - a program derived from Sci-Plot</li>
</ul><p><br /><br /></p>
<p>I already discussed how to add a quadratic fit in Excel using the built in tools. Perhaps later I will also discuss Logger Pro and Plot. But how do you come up with a function to fit data? The basic idea is to create a quadratic function and vary the parameters such that the deviation of the actual data from the function is minimized. That is much detail as I want to go into except for the following two links that I used:</p>
<ul><li><a href="http://www.personal.psu.edu/jhm/f90/lectures/lsq2.html">A good description of Least Squares Fit to Quadratic Data</a></li>
<li>Part of a least squares fit involves solving three equations with three unknowns. <a href="http://www.dslimited.biz/excel_tutorials/simultaneouslinearequations.html">Here is a description of using Excel's Solver to do this</a></li>
</ul><p><br /><br /></p>
<!--more--><p>
To create data, I looked at the vertical position of a drop of water from a splash from a slow motion video. I can't remember where I found the video, but here is a screen shot:</p>
<p>![Screenshot 28](/dotphysics/wp-content/uploads/2008/09/screenshot-28.jpg)</p>
<p>I used [Tracker Video Analysis](<a href="http://www.cabrillo.edu/~dbrown/tracker/">http://www.cabrillo.edu/~dbrown/tracker/</a>) to get the position and time data for one of the water drops. </p>
<p>![Screenshot 29](/dotphysics/wp-content/uploads/2008/09/screenshot-29.jpg)</p>
<p>I fit this data (using the methods described above) with a function of the form:</p>
<p>![Screenshot 30](/dotphysics/wp-content/uploads/2008/09/screenshot-30.jpg)</p>
<p>Note that there are no real units for position since I didn't take the time to "scale" the video. I could scale it by assuming the acceleration is -9.8 m/s<sup>2</sup> if I had wanted to. Here is what each method produced for the coefficients:</p>
<p>![Screenshot 31](/dotphysics/wp-content/uploads/2008/09/screenshot-31.jpg)</p>
<p>From this, it seems there is essentially no difference (except in rounding). Maybe Excel gives a bad result for linear fitting, I can try that later. </p>
<p>So, which program should you use to fit data? Here is the low-down.</p>
<ul><li><b>Manual</b>: The main benefit of doing something like this manually is that you know exactly what is happening. Plus it makes you feel cool. The down side is that it is rather tedious.</li>
<li><b>Excel</b>: If you are familiar with this, go for it. Maybe there are some situations that Excel does it wrong, but looks ok in this case. The down side is that it is not free and the graphs it makes are not pretty</li>
<li><b>Logger Pro</b>: I like this program. It not only collects data from the vernier sensors, but makes a great stand-alone graphing program. It is not free, but there a couple of features I like. First, you can easily select which part of a data set you want to fit the function to. Second, it gives you uncertainties in the coefficients of the fitting function.</li>
<li><b>Plot 0.997</b>: I call it Plot 0.997 because if you just do a google search for Plot you will never find it. Plot 0.997 is a pretty good program. It makes really nice and customizable graphs. It's free. The down sides: it only runs on Mac OS X (but sci-plot is available for Windows), I found a couple of bugs and sometimes it is difficult to figure things out</li>
<li><b>Other Stuff</b>: There are many alternatives here. First, you math programs like Matlab, Mathematica, and Maple - oh and the free Octave. Then there is gnuplot. Also there is gnumeric. I don't have much experience with these.</li>
</ul><p><br /><br /></p>
<p>There you have it. Go forth and fit data.</p>
</div>
<span><a title="View user profile." href="https://scienceblogs.com/author/rallain" lang="" about="https://scienceblogs.com/author/rallain" typeof="schema:Person" property="schema:name" datatype="" xml:lang="">rallain</a></span>
<span>Thu, 09/25/2008 - 04:40</span>
<div class="field field--name-field-blog-tags field--type-entity-reference field--label-inline">
<div class="field--label">Tags</div>
<div class="field--items">
<div class="field--item"><a href="https://scienceblogs.com/tag/physics" hreflang="en">Physics</a></div>
<div class="field--item"><a href="https://scienceblogs.com/tag/fitting-0" hreflang="en">fitting</a></div>
<div class="field--item"><a href="https://scienceblogs.com/tag/function" hreflang="en">Function</a></div>
<div class="field--item"><a href="https://scienceblogs.com/tag/graphs" hreflang="en">graphs</a></div>
<div class="field--item"><a href="https://scienceblogs.com/tag/kinematics" hreflang="en">kinematics</a></div>
</div>
</div>
<section></section><ul class="links inline list-inline"><li class="comment-forbidden"><a href="https://scienceblogs.com/user/login?destination=/dotphysics/2008/09/25/comparison-of-quadratic-curve-fitting%23comment-form">Log in</a> to post comments</li></ul>Thu, 25 Sep 2008 08:40:04 +0000rallain107714 at https://scienceblogs.com