TactivergeLite

Lite / Independent Engineering Research / Week 8

Fitting and validating a model against data

A recorded decay gives you seven peaks. How do you get the damping out of them, and how do you know the model deserved to be fitted?

About 50 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

A model's parameters are rarely known in advance. Engineers measure, fit, and then test the fit on fresh data. This is the honest loop between theory and reality, and the skills carry straight into estimation next term.

Predict

Peak amplitudes of a decaying oscillation are plotted as ln(peak) against time. If the model with linear damping is right, what shape do you expect?

  1. A straight line with negative slope
  2. A parabola
  3. A horizontal line
Guess first, then reveal

Peaks follow A₀e^{−ζω_n t}, so ln(peak) = ln A₀ − ζω_n t: a straight line whose slope is −ζω_n.

Discover

Choose 'Damped decay, ln(amplitude)'. Fit a line by hand, then reveal the least-squares line. Read the slope: that is −ζω_n. Look at the residuals: are they random?

What the interactive shows (text version)

The least-squares diagram with the damped-decay data set plots ln(peak amplitude) against time, with your line, residual segments and, on request, the best-fit line. Text reports slopes, intercepts and sums of squared residuals.

You can also open the interactive on the full site when you have a faster connection.

Understand

Question → method → evidence

Question: what is the damping, and does linear damping describe this system? Method: extract peaks, fit ln(peak) against t, then predict a second recording. Evidence: the fitted slope with its uncertainty, residual plot, and prediction error on the held-out recording.

A worked fit

For the diagram's decay data (peaks at t = 0…6 s), least squares gives slope −0.304 per second and intercept 0.012. So ζω_n ≈ 0.30 s⁻¹ and A₀ ≈ e^{0.012} ≈ 1.01. If the peak spacing gives ω_d = 2.0 rad/s, then ω_n ≈ 2.02 rad/s and ζ ≈ 0.15.

Validation, not just fitting

A model can always be fitted to the data it was fitted to. Validation uses different data: a second run, another amplitude, a different day. Report the prediction error there. Patterned residuals (for example a curve in ln(peak)) suggest a wrong assumption, such as friction that does not scale with speed.

Explain it another way

Intuitive

Fitting is tailoring a suit to someone; validation is checking it still fits when they walk around.

Technical

Prediction error on held-out data estimates how the model generalises; error on the fitting data is optimistically biased.

Applied

Vehicle engineers fit damper models on a test rig, then validate against road-test recordings before using the model in ride simulations.

Derivation: Turning a decay into a straight-line fit
  1. Underdamped solution: x(t) = A₀ e^{−ζω_n t} cos(ω_d t + φ). Peaks occur about every 2π/ω_d with heights Aₖ ≈ A₀ e^{−ζω_n tₖ}.

  2. Take logs: ln Aₖ = ln A₀ − (ζω_n) tₖ. This is linear in the unknowns (ln A₀, ζω_n).

  3. Fit yₖ = ln Aₖ against tₖ by least squares (week 5): slope m = −ζω_n, intercept c = ln A₀.

  4. With ω_d measured from the peak spacing, ω_n = √(ω_d² + (ζω_n)²), so ζ = (ζω_n)/ω_n.

  5. Caution: taking logs changes the noise. Small peaks have large relative noise, so ln weights them oddly; with good data this is a small effect, but it should be stated.

Worked example 1

Peaks: 1.00, 0.74, 0.55, 0.41 at t = 0, 1, 2, 3 s. Estimate ζω_n.

ln peaks: 0, −0.301, −0.598, −0.892. These fall by about 0.297 per second; the least-squares slope is −0.297, so ζω_n ≈ 0.30 s⁻¹.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

Practice 3. Which is the best evidence that your fitted model is useful?
Practice 4. ln(peak) residuals curve upwards at late times. A plausible explanation?

Apply it

Record (or simulate with added noise) two decays of the same oscillator. Fit ζω_n on the first, predict the peaks of the second, and report the root-mean-square prediction error and what it suggests.

Reflect

When have you seen a model fitted and never validated?

Write your answer on paper or in your own notes. Lite never stores what you write.

Go further

Research mode: limits and open questions

Next term this becomes formal estimation: least squares as an estimator with bias, variance and confidence intervals.

← Models from first principles, and non-dimensionalisingLinearising nonlinear models →