Skip to content
Get started

1. Measurements to parameters

A signal has fallen to half its initial value

Section titled “A signal has fallen to half its initial value”

You observe a signal one second after starting an experiment. Its initial value was 1 and its new value is 0.5. How fast is it decaying?

A forward problem starts with a rate and predicts the signal. An inverse problem starts with the signal and asks about the rate. Both need the same physical model. Here we assume the rate is constant, the signal is proportional to the state, and the instrument has no unknown offset.

The model says that the loss per unit time is proportional to the amount present:

dxdt=kx,x(0)=x0,k>0.\frac{dx}{dt}=-kx,\qquad x(0)=x_0,\qquad k>0.

The state xx is dimensionless, time tt is in seconds, and kk is in inverse seconds. Dividing by xx and integrating gives

log(x/x0)=kt,x(t)=x0ekt.\log(x/x_0)=-kt,\qquad x(t)=x_0e^{-kt}.

We have derived the forward answer before touching a solver. The ODE lesson explores the evolution equation in more detail.

For one observation dd at a known positive time tt, with known x0x_0,

k=1tlog(dx0).k=-\frac{1}{t}\log\left(\frac{d}{x_0}\right).

Our observation gives k=log20.693147s1k=\log 2\approx0.693147\,\mathrm{s}^{-1}. The formula requires d>0d>0. Under the assumed decay model, d>x0d>x_0 would produce a negative fitted rate and therefore contradict the assumption of decay.

This is an unusually simple inverse problem: the answer is explicit. It is still worth stating the components separately.

Role This experiment
Unknown parameter kk
State x(t;k)x(t;k)
Observation rule Read xx at t=1st=1\,\mathrm{s}
Data d=0.5d=0.5
Objective 12[x(1;k)d]2\tfrac12[x(1;k)-d]^2

An observation rule can instead average a region, sample several times, or convert a physical quantity to instrument units. Keeping that rule explicit prevents fitting a model output that the instrument never measured. For the linear algebra of observations and data fitting, see Boyd and Vandenberghe, Introduction to Applied Linear Algebra, chapters 7 and 13, in the authors’ edition.

Use the shared Get started files and environment. Their model is:

decay.eqi
// A minimal implicit ODE: x decays at the rate supplied by the user.
model decay() {
// `x` is dimensionless and starts at 1. `rate` has inverse-time units.
state x: 1;
initial { x = 1; }
parameter rate: 1 / s = 1;
// Eqiora writes the evolution law as a residual equal to zero.
relation flow {
derivative(x) + rate * x = 0;
}
}

Change rate to 0.6931471805599453 and run the script:

Terminal windowbash
uv run --no-project --python .venv/bin/python python run.py

Predict the printed values first: about 0.8408960.840896 at 0.250.25 seconds, 0.7071070.707107 at 0.50.5 seconds, and 0.50.5 at one second. The shared run script handles compilation, time integration, and sampling; the equation remains in .eqi.

The final sample was used to choose kk. The earlier samples are additional predictions. If independently measured values disagree with them, changing kk to match one observation more closely will not necessarily repair the model. An unknown initial condition, an instrument offset, or a changing rate may matter.

One observation now obeys d=x0ektd=x_0e^{-kt}. For every chosen kk there is an x0=dektx_0=de^{kt} producing exactly that observation. A good fit cannot select between them. Two positive measurements at distinct times allow the ratio

d2d1=ek(t2t1),k=log(d2/d1)t2t1.\frac{d_2}{d_1}=e^{-k(t_2-t_1)},\qquad k=-\frac{\log(d_2/d_1)}{t_2-t_1}.

This removes x0x_0, after which either observation determines it. The result assumes the two samples share one initial condition and one constant rate.

  1. Recover kk when x0=2x_0=2 and x(3s)=0.25x(3\,\mathrm{s})=0.25. Give its units.
  2. Fit kk from x(1)=0.5x(1)=0.5 and predict x(2)x(2). Would a new measurement of 0.4 agree with this model? Name one additional experiment that could help explain it.
  3. With unknown x0x_0, use d1=0.8d_1=0.8 at one second and d2=0.4d_2=0.4 at three seconds to recover both parameters.
  4. Differentiate the one-observation estimate with respect to dd. Explain why a small absolute measurement error becomes troublesome near zero.

Check your reasoning: exercise 1 gives k=log8/3k=\log 8/3; exercise 3 gives k=log2/2k=\log 2/2 and x0=0.82x_0=0.8\sqrt{2}.

Stephen Boyd and Lieven Vandenberghe, Introduction to Applied Linear Algebra: Vectors, Matrices, and Least Squares, Cambridge University Press, 2018, chapters 7 and 13. Book and author resources.

Book map · Next: Recovering a heat source