Beware of using a tool you don't understand... "Excel give me..." is a sentence that sets alarm bells off in my head.
A few points:
- When you do an experiment, you should formulate a hypothesis regarding the underlying physics before you look at the results. "I expect that the terminal velocity will scale linearly with the mass of the cup" could be such a hypothesis. It would be best if you used some physical reasoning to come up with the hypothesis (just saying "it will be linear", while a hypothesis, is really just guessing). Ideally you set up the experiment to help you prove / disprove the hypothesis.
- In order to get a straight line, you transform your data according to your hypothesis. If you think that $y = a x^2$, you could plot $y$ as a function of $x^2$ and would expect a straight line. This has two advantages: a) the slope of the straight line will be the parameter $a$, and b) you will be able to see a systematic deviation from the straight line readily
- Plot the residuals. Sometimes, you have data that looks like a beautiful straight line; but if you compute the fitted straight line and subtract it from the data, the result might have some definite shape (curvature). This could happen because of some small non-linearity you didn't account for in an otherwise careful experiment.
Sometimes it's not possible to transform your data, and you end up having to do a fit. This can be one of two types:
- Linear regression: this is the "nice" type of fit because it can be solved analytically. As long as you have more data points than parameters in the fit, there is a closed form solution. This solution takes the form of solving a set of equations, and there is no guarantee that these equations are not (almost) singular - but it's comparatively easy. Example $$y = ax^2 + bx + c$$
- Non linear: if your expected fit is of the type $$y=a x^b + c x^d$$ it is hard to come up with a good transformation, and since you don't know $b$ and $d$ in advance some of the techniques used for solving polynomials etc don't apply. In that case there are numerical techniques to find approximations to $a,b,c,d$.
Excel has various kinds of fitting built in: when you right-click on a data series in a graph, you can select "add trendline" which gives you various options - including "polynomial". You can even show the equation of the trend line on the graph - this is under "options".
Example:
A nice smooth curve was fitted that looks like a good match to the data - and you can see the equation of the curve. However - in this case the actual function I used was
$$y = 0.5 + 3x + 2x^2 + 4\sqrt{x}$$
- and in Excel there is no good built in way to find the coefficients (0.5, 3, 2, 4) . It is possible to use Excel to find these coefficients, by manually recreating the math needed for the calculation. If you have data points $x_i, y_i$, and you believe that $y$ is a linear combination of various functions $f_i(x)$, you can do the following:
Compute the matrix
$$F_{ij} = f_i(x_j)$$
Next, compute
$$M = F F^T$$
Finally, compute
$$Y_j = y_i F_{ij}$$
Now the solution is
$$c = M^{-1} Y$$
I have created a small example (from which the above graph was created) that shows how this is done in Excel. First, the formulas:
And next, the values:
Note - a lot of the matrix calculations (MMULT
, MINVERSE
) require you to select the entire range where you need to put the formula, type the expression in the formula bar, then press CMD-SHIFT-ENTER
on Mac, or CTRL-SHIFT-ENTER
on PC. You can find a copy of this spreadsheet at http://www.floris.us/SO/curveFit.xlsx
If you want to be really clever, you can do something similar for the non-linear case - but now you will have to use the Solver (comes with Excel) to solve for all the parameters.
Now you can really impress your teacher with your new found data fitting skills... but the bottom line is still this:
You need to understand why the function you are fitting is of a particular form; if you don't, then it doesn't matter how good you are at fitting data - you are not really "doing physics".
If you do understand the form, then the coefficients you are solving for might be meaningful things like "viscosity of air", "gravitational constant", "apparent area of cup", or whatever else your experimental analysis tells you that you're solving for.