uncertainty quantification
Engineering models love exact numbers: this beam has stiffness , that damper has coefficient . Real parts don’t come with exact numbers. Material properties scatter from batch to batch, joints add damping nobody modelled, and every sensor adds its own noise on top. Uncertainty quantification is the habit of taking that seriously: treat the parameters you don’t know as random variables, and ask what that does to the answers you care about.
These notes follow a short book by Daniel Alves Castello and Thiago Gamboa Ritto, Quantificação de incerteza e estimação de parâmetros em dinâmica estrutural, which builds everything from computational examples in MATLAB. I went through the theory and translated the examples to Python; the notebooks are on GitHub. Here is the condensed version, with the two main examples running in the page.
the recipe
The book frames the whole thing as a loop with six steps:
- deterministic model. Write the physics, and pick which parameters you are unsure about.
- stochastic model. Give each of those parameters a probability distribution. A bad choice here gives a bad answer later, however careful the rest is.
- propagation. Work out the distribution of the outputs. There are theorems that relate the output density to the input one, but they rarely give anything you can compute, so in practice this means Monte Carlo.
- identification. Use measurements to estimate the parameters.
- analysis. Use the stochastic model: envelopes, reliability, robust design.
- update. When new data arrives, revise the distributions (usually with Bayes) and go round again.
The two examples below are steps 3 and 4 on the simplest dynamic system there is.
a warm-up: one spring
Before anything moves, take a static test. Push on a spring, measure displacement and force , and assume Hooke’s law. The force sensor is noisy, so what you actually record is
Least squares picks the that minimises . Setting the derivative to zero gives
That is a point estimate, a single number, and it is easy to stop there. But substitute the model for and look at what comes out
The estimate is itself a random variable. It is unbiased, and its spread shrinks with , so more points, or points at larger displacements, pin it down better. With the notebook’s numbers (, five points at , ) the standard deviation of is . One run gave , which looks like a poor fit until you see it is well inside that spread. Keep that in mind, it comes back at the end.
the oscillator
Now a mass on a spring with a damper, the one-degree-of-freedom model behind a surprising amount of structural dynamics
Fourier-transform it and the derivatives turn into powers of , so the ratio between displacement and force at each frequency, the frequency response function, is
| with natural frequency and damping ratio . Its magnitude peaks near , and the height of the peak is set almost entirely by the damping: at exactly, . |
Damping is the parameter we know worst. Stiffness and mass can be computed from drawings; damping comes from friction in joints, material hysteresis and air, and is usually guessed. So we fix and rad/s, and say all we know about the damping ratio is that it lies between 5 % and 20 %
Now is a random function: one curve per value of .
propagating it
Monte Carlo is the bluntest tool that works: draw samples from the distribution, compute the response for each, and treat the pile of curves as a sample of the random output. Means are approximated by averages,
and an envelope that holds 98 % of the responses is the 1st and 99th percentiles at each frequency.
What the figure says is more useful than any single curve.
Below about 6 rad/s the envelope is a thin ribbon. The system is quasi-static there, the spring does all the work, and not knowing the damping barely matters: at 6 rad/s the whole band is about 0.030 to 0.035 m/N. Near the resonance it is the opposite. The peak goes from 0.039 m/N at 20 % damping to 0.156 m/N at 5 %, a factor of four. If your loads sit well below , you can stop worrying about damping. If they can reach it, the damping you guessed decides the answer.
The dashed mean and the thin white curve are not the same thing. The white one is the response of the average damping, the dashed one is the average of the responses, and at the peak the second is clearly higher: about 0.072 against 0.0625 m/N. The peak goes as , which is convex, so low-damping samples pull the average up more than high-damping ones pull it down. Plugging the mean parameter into the model does not give the mean behaviour, and that is the single best argument for doing the propagation at all.
Try 10 samples and press draw again a few times: the envelope jumps around. The Monte Carlo estimate is a random quantity too, its error falls like , and percentiles in the tails need many more samples than the mean does.
identifying it back
So far the model has fed itself. Step 4 goes the other way: given measurements of the real system, find the damping. The book makes synthetic ones by taking the true response, with , and multiplying each point by an independent 15 % error
and then looks for the damping that makes the model closest to the data
| This time the model is not linear in the parameter, so there is no closed formula like the one for . The usual tool is Levenberg–Marquardt. With the residuals and their derivatives , each iteration takes the step |
With near zero this is a Gauss–Newton step, which converges fast when you are close. With large it becomes a short step down the gradient, which is safe when you are far. After every step, if the error went down, is divided by ten; if it went up, the step is thrown away and is multiplied by ten. The figure does exactly that, starting from , the same as the notebook (which calls SciPy’s least_squares with method='lm').
One experiment gives a curve that sits almost on top of the true one, and it is tempting to call the damping identified and move on. Press measure 100 times and the spring example comes back. With 101 points and 15 % noise, lands around 0.125 with a standard deviation of about 0.006, roughly 5 %. That is much narrower than the 0.05 to 0.20 we started from, but it is still a distribution and not a number. More points narrow it, more noise widens it, and with 21 points at 40 % noise it spreads over most of the original range and starts to drift high: few points near the peak, and multiplicative noise there, is a bad combination.
That is where the loop closes. The spread of is exactly the kind of thing step 2 asks for: a better-informed distribution to feed back into the propagation, and making that update properly, combining what we believed before with what the data says, is the job of Bayes’ theorem in step 6.