1Today's goals
- Follow the modelling cycle: question, assumptions, equation, fit, validate, use
- Non-dimensionalise to find the time scales that matter
- Fit ODE parameters by least squares and judge the fit from residuals
- Use the rate plot y′ against y to choose a model
- Turn a fitted model into a decision — when is a test "stabilised"?
2The modelling cycle
- Ask a precise question. "When will the oil temperature be stable enough to take readings?" is a modelling question; "model the gearbox" is not.
- List assumptions. Well-mixed oil, constant load, constant room temperature, heat loss proportional to temperature rise.
- Write the balance. m·c·T′ = Ploss − h·A·(T − Troom) — a first-order lag.
- Non-dimensionalise. Find the natural scales (here τ = m·c/(h·A) and ΔT = P/(h·A)); they show which parameters matter and which terms are negligible.
- Fit the unknown parameters to data.
- Validate on data you did not fit — a different run, a different load.
- Use the model, and say how far it can be trusted.
3Least squares for ODE models
Given measurements (ti, yi) and a model y(t; p) obtained by solving the ODE with parameters p, choose p to minimise
For an ODE there is usually no formula for the best p, so a search algorithm adjusts p, re-solves the ODE, and repeats: Nelder–Mead (used in the lab), Gauss–Newton or Levenberg–Marquardt. Report the fit with its RMS error and R², and always look at the residuals yi − y(ti; p): they should look like noise. A smile, a wave or a trend means the model is wrong, however high R² is.
Identifiability and over-fitting
Some parameter combinations cannot be told apart from the data. In SIR fitted only to the early, exponential phase, the data fixes β − γ (the growth rate) but not β and γ separately — many pairs fit equally well and predict very different peaks. That is practical non-identifiability; the cure is better data (the turning point) or prior knowledge (the known infectious period). Adding parameters always reduces S on the fitted data; judge models with fresh data, or penalise complexity (AIC, BIC).
4The rate plot: choose the model before you fit
For an autonomous first-order model y′ = f(y), estimate the slope of the data by finite differences, (yi+1 − yi−1)/(ti+1 − ti−1), and plot it against y. The points trace out f itself:
| Shape of y′ against y | Model |
|---|---|
| Straight line falling through zero at y∞ | First-order lag: y′ = (y∞ − y)/τ, slope −1/τ |
| Straight line through the origin | Exponential growth or decay |
| Upside-down parabola through 0 and K | Logistic |
| A curve bending down at large y | Quadratic loss, e.g. windage: ω′ = −a − bω² |
It turns a curve-fitting guess into a picture of the differential equation itself — the theme of this course.
5Worked example
6Lab: model fitter
Choose a data set. Edit the parameters by hand and watch three plots: data and model, the rate plot (data slopes against the model's f), and the residuals. Then press Auto-fit. Choose "Your own data" and paste two columns (time, value) from a spreadsheet to fit your own rig or process.
7Pro tips and common mistakes
- Finite-difference slopes amplify noise. Sample often enough, average, or smooth before the rate plot — never before the fit itself.
- Fit in the units the data was measured in; check that parameters come out physically sensible (positive time constants, capacities above the data).
- A model that fits one run is a hypothesis. A model that predicts the next run is knowledge.
- Keep the model as simple as the question allows. A first-order lag that is good to ±1 °C is worth more than a twelve-parameter model nobody can check.
8Practice
- In the lab, fit the oil data, then change τ by ±20 % by hand. How do the residuals change shape?
- Fit the tea data with the first-order lag model instead of Newton cooling. Do you recover room temperature as y∞?
- Fit the SIR data. What is R₀? Now imagine you only had the first 30 days — would β and γ be well determined?
- Paste a warm-up log from a real machine (time in minutes, temperature) and find its τ.
9Quick quiz
5 questions. Click an answer — you get the explanation straight away.