Advanced maths

Observability Gramian calculator with initial state reconstruction

Evaluate continuous-time observability and reconstruct an initial state from time-stamped output samples of an unforced linear system.

Your numbers

Finite real values; comma-separated columns and separate lines for matrix rows.
Finite real values; comma-separated columns and separate lines for matrix rows.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Evaluate continuous-time observability and reconstruct an initial state from time-stamped output samples of an unforced linear system. The page reports the continuous observability Gramian separately from the trapezoid-weighted sampled design used for reconstruction. This separation exposes how sensor timing and finite data affect the inverse problem, even when the underlying continuous system is observable.

THE FORMULAW_o(T)=∫₀ᵀ exp(Aᵀt)CᵀCexp(At)dt. H_k=Cexp(At_k); sampled G=Σw_kH_kᵀH_k, b=Σw_kH_kᵀy_k; x̂₀=G⁺b. w_k are composite-trapezoid time weights, not inverse measurement variances.

A worked example

For A=[[0,1],[0,0]], C=[[1,0]], times0,.25,.5,.75,1 and outputs2,2.75,3.5,4.25,5, the reconstructed state is[2,3]. The continuous Gramian is[[1,.5],[.5,1/3]], while the sampled one is[[1,.5],[.5,.34375]]. Both give the same exact state here because the outputs follow the noiseless model.

Good to know

Constant finite A of order1–3 and C with1–3 output rows and matching state columns. Horizon0<T≤20 and matrix-time norm≤80. 2–100 strictly increasing sample times beginning0 and endingT, with aligned output rows. Reconstruction minimizes trapezoid-weighted discrete residuals using a numerical spectral pseudoinverse. Rank refers to sampled Gramian; rank-deficient output is a minimum-norm representative, not a unique hidden state. No known-input subtraction, stochastic filter, covariance or regularization.

Initial state is inferred through known dynamics

With no input, the model gives x(t)=exp(At)x₀ and y(t)=Cexp(At)x₀. The unknown is one initial state vector shared by all observation times.

This is not a sequential filtering calculation with process noise and measurement covariance updates. Every output row contributes to one finite-horizon inverse problem, and the system matrices are treated as known rather than estimated from the same data.

Observability Gramian calculator with initial state reconstruction worked exampleSampled reconstruction is distinct from continuous observabilityOutput y(t) = 2 + 3tContinuous Gramian[[1, .5], [.5, 1/3]]Sampled Gramian[[1, .5], [.5, .34375]]Reconstructed initial state [2, 3]Exact model fit; distinct continuous and sampled matrices
Scroll across to see the full diagram.
For A=[[0,1],[0,0]], C=[[1,0]], times0,.25,.5,.75,1 and outputs2,2.75,3.5,4.25,5, the reconstructed state is[2,3]. The continuous Gramian is[[1,.5],[.5,1/3]], while the sampled one is[[1,.5],[.5,.34375]]. Both give the same exact state here because the outputs follow the noiseless model.

Compare this with the Kalman filter calculator from noisy measurements. Filtering noisy sequential measurements is not a finite-horizon observability or initial-state inverse problem.

Continuous and sampled Gramians are different

The continuous observability Gramian integrates H(t)ᵀH(t) over the entire interval. It describes information available from an ideal continuous output history.

Reconstruction on this page uses only entered samples, with composite-trapezoid weights. Its sampled Gramian is a weighted sum and can differ in value or rank. Displaying both matrices prevents a continuous observability result from being mistaken for a guarantee about a particular sampling schedule.

Trapezoid weights describe time spacing

Each endpoint sample receives half its adjacent time interval, while an interior sample receives half the span between its neighbors. This approximates an integrated squared-residual objective on nonuniform time grids.

These weights are not inverse noise variances or a claim that some measurements are more precise. If a sensor’s error variance differs by sample, this page does not model it. Changing the sampling grid changes this discrete approximation even if the continuous system stays fixed.

Reconstructing the supplied position history

The default system has constant velocity with position as its only observed output. Starting position two and velocity three produce y(t)=2+3t, matching every supplied sample. The weighted least-squares state is therefore[2,3] with residual near zero.

The t² term in HᵀH integrates continuously to1/3, but its five-point trapezoid sum is.34375. That visible difference is expected quadrature behavior. It does not prevent exact reconstruction when all samples lie in the fitted model subspace.

Observable directions and numerical rank

An initial-state direction is unobservable from the samples if adding it changes none of the sampled outputs. In matrix terms it lies in the null space of the sampled design and Gramian.

The spectral solve omits numerically small eigenvalues and reports the resulting rank. If rank is below the state dimension, the returned vector is a minimum-norm representative among observationally equivalent states. The unique flag is false and should be shown prominently.

Residual size does not prove a unique state

An unobservable system can fit its output history perfectly while leaving some state coordinates undetermined. Conversely, a full-rank sampled design may have nonzero residual because noisy observations do not lie exactly in the model’s output subspace.

Interpret the rank, eigenvalues and weighted residual together. A small eigenvalue can make reconstruction sensitive to tiny data changes even with formal full rank. This routine applies no hidden ridge penalty to mask that instability.

Inputs and model errors require separate handling

Known forcing can be accounted for by subtracting its predicted output contribution before reconstructing the free initial state, but this page does not perform that step. Raw outputs from a forced system generally do not follow the displayed unforced formula.

Errors in A, C, timestamps or output units also affect reconstruction. The reported residual measures fit within the supplied model and weighting convention; it is not an uncertainty interval for the true initial state.

A few questions, answered

Which Gramian is used to reconstruct the state?

The trapezoid-weighted sampled Gramian. The continuous Gramian is reported separately.

Are the weights measurement precision?

No. They are time-integration weights determined by sample spacing.

Can residual zero occur without a unique state?

Yes. Unobservable directions can remain unconstrained while all outputs fit exactly.

Is this a Kalman filter?

No. It is a finite-horizon initial-state least-squares reconstruction without noise covariance updates.

Find your calculator

Start typing to explore the library.