ltv_state_est¶
MATLAB equivalent:
sidLTVStateEst
ltv_state_est ¶
Batch LTV state estimation (RTS smoother).
ltv_state_est ¶
ltv_state_est(Y: ndarray | list[ndarray], U: ndarray | list[ndarray], A: ndarray, B: ndarray, H: ndarray, *, R: ndarray | None = None, Q: ndarray | None = None) -> ndarray | list[ndarray]
Estimate state trajectories for a partially observed LTV system.
This is the Python port of sidLTVStateEst.m.
Estimates state trajectories for a discrete-time LTV system with partial observations by minimising
.. math::
J = \sum_k \|y(k) - H\,x(k)\|^2_{R^{-1}}
+ \sum_k \|x(k{+}1) - A(k)\,x(k) - B(k)\,u(k)\|^2_{Q^{-1}}
This is equivalent to a Rauch-Tung-Striebel (RTS) fixed-interval smoother. Solved via a block tridiagonal forward-backward pass in O(N n^3) per trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Y
|
ndarray or list of ndarray
|
Output data. Accepted formats:
|
required |
U
|
ndarray or list of ndarray
|
Input data, matching format of Y:
|
required |
A
|
ndarray, shape ``(n, n, N)``
|
Time-varying dynamics matrices. |
required |
B
|
ndarray, shape ``(n, q, N)``
|
Time-varying input matrices. |
required |
H
|
ndarray, shape ``(py, n)``
|
Observation matrix. |
required |
R
|
ndarray, shape ``(py, py)`` or None
|
Measurement noise covariance (symmetric positive definite).
Default: |
None
|
Q
|
ndarray, shape ``(n, n)`` or None
|
Process noise covariance (symmetric positive definite).
Default: |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
X_hat |
ndarray or list of ndarray
|
Estimated states.
|
Raises:
| Type | Description |
|---|---|
SidError
|
If Y is a list but U is not (code: |
SidError
|
If data dimensions are inconsistent (code: |
Examples:
State estimation with known dynamics:
With known measurement and process noise:
Notes
Specification: SPEC.md section 8.12 -- Output-COSMIC state step; docs/cosmic_output.md -- Appendix A
Algorithm:
- Precompute
R^{-1},Q^{-1},H^T R^{-1} H,H^T R^{-1}. -
Build shared block tridiagonal system:
-
Diagonal blocks
S[k]encoding observation and dynamics information. -
Off-diagonal blocks
U_c[k] = -A(k)^T Q^{-1}. -
Per trajectory, construct the right-hand side
Theta[k]from the output data and input data. - Solve the block tridiagonal system via
:func:
~sid._internal.ltv_blk_tri_solve.blk_tri_solve. - Extract state estimates from the solution.
Complexity: O(L * N * n^3).
See Also
sid._internal.ltv_blk_tri_solve.blk_tri_solve : Block tridiagonal solver used internally. sid.ltv_disc : LTV state-space identification via COSMIC.
Changelog
2026-04-09 : First version (Python port) by Pedro Lourenco.