Curve Fitting

Many scientific experiments result in measurements of two variables, x and y. Curve fitting means finding an equation that represents the relationship between those data points. It means trying out different equations and testing to see how closely they describe the data.


When you first learned physics, your teacher might have taught you a simple way to fit curves. You plotted the data points on a graph and moved your ruler around until it seemed like the line was equidistant from all the points. Numerical analysis makes that eyeball guess a bit more scientific.


There are two general approaches to curve fitting. When your data is not very exact and you think you have a linear relationship between x and y, you use "least-squares regression." When you know your data is very precise, you use "interpolation." The latter is quite involved, and beyond the scope of this course, so we won't go into it here. This chapter focuses on least squares regression.


Figure 2.1: A graph of some data points


Figure 2.2: A line between data points found using lease squares regression


Figure 2.3: A curve through data points found using interpolation