Using Excel to fit a damped sinusoid to experimental
data:
y = A exp(-gt) cos(wt
+ f) [Eq.
1]
PREPARATION of RAW DATA FILE: Prepare a text file under DOSEDIT
or a similar editor, with column headings labelled "t"
and "y_obs" to denote time and experimental displacement.
Enter successive t and y_obs values, using a tab to go from first
to second column . Save file to floppy disk as a:\myrawdata.
PROCESS the raw data in EXCEL spreadsheet, as follows.
1. Open Excel. From the menu, choose:
2. Create new column headings y_fit and error for theoretical y-values computed by the above equation, and deviations between theory and experiment, y_fit - y_obs.
3. Set up cells for the parameter names and values, as follows:
In free column space to the right of your data, set up two short
columns for the five unknowns and c2,
the function we will minimize to get the best fit:
| Parameter | Value |
| A | |
| gamma | |
| w | |
| phi | |
| B | |
| chi_squared |
The unknowns A, gamma, w, and phi correspond in obvious ways to
the parameters of eq. 1. Since the value of yfit at
t = is zero in equation 1, but not zero in the experiments, we
must include an extra parameter B (for Baseline) for this
offset. The parameter phi is, in a similar way, an offset of the
t axis.
Next, create six empty boxes in the Value column, to hold the 6 unknowns:
4. Enter approximate, estimated values of the 5 parameters in
the empty cells created in step 3, for example A=10, gamma=0.001,
w=0.01,phi=0, B = 50. Leave the chi_squared box empty.
5. Type in the procedure by which Excel should compute y_fit in Column C. If the first cell of y_fit is C2, and the first cell of t is A2,
=A*EXP(-gamma*$A2)*cos(w*$A2+phi) - B
7. Compute c2 , the sum of the squares of the deviations between y_obs and y_fit, using Excel's "SUMSQ" function:
=SUMSQ(D2:DNN)
8. Now ask Excel's SOLVER routine to minimize chi_squared:
New values of the A, gamma, w, phi, B, and etc should be computed
in a few seconds, and new values of y_fit should appear. If they
do not, one way to trace your error is to use the "Audition"
function under "Tools". It places arrows on the spreadsheet
to tell how information flows from one cell to another.
9. You will find it useful to make plots of your raw data and, on the same graph, the data which are generated by the assumed functional form with its "best-fit" parameters.
10. The fitted parameters A, w, etc should correspond closely
to your manual estimates. Recalculate G using the fitted parameters
from Excel.
[an error occurred while processing this directive]