sid is a free, open-source toolbox for system identification — covering both non-parametric frequency response estimation and time-varying state-space identification. All implementations share a single mathematical specification and cross-language reference test vectors to ensure numerical consistency.
- Blackman-Tukey spectral analysis — frequency response and noise spectrum estimation with configurable window size
- Frequency-dependent resolution — vary the smoothing bandwidth across the frequency axis
- Empirical transfer function estimate — maximum resolution via FFT ratio, with optional smoothing
- Time-varying frequency maps and spectrograms — sliding-window analysis for non-stationary signals
- LTV state-space identification (COSMIC) — identify time-varying A(k), B(k) with O(N) complexity, automatic regularization, and Bayesian uncertainty
- Partial-observation identification (Output-COSMIC) — identify dynamics from output-only measurements
- Multi-trajectory support — ensemble averaging for frequency estimates; pooled least-squares for state-space
- Asymptotic uncertainty estimates — confidence bands for all estimation functions
- Analysis and validation — detrending, residual diagnostics, and model comparison
- SISO, MIMO, and time-series modes — unified API across all estimation functions
| Language | Status | Directory | README | Requirements |
|---|---|---|---|---|
| MATLAB/Octave | Stable | matlab/ |
README | MATLAB R2024a+ or GNU Octave 11+ |
| Python | Stable | python/ |
README | Python 3.10+, NumPy 1.22+, SciPy 1.8+ |
| Julia | Planned | julia/ |
README | TBD |
See each language's README for installation, quick start, function reference, and compatibility details.
Tip: Only need one language? Use a sparse checkout.
git clone --no-checkout https://github.com/pdlourenco/sid.git sid
cd sid
git sparse-checkout init --cone
git sparse-checkout set spec testdata matlab # replace 'matlab' with your language
git checkoutThis downloads only the shared specification, test data, and your chosen implementation.
Frequency-domain path. The core spectral estimators use the Blackman-Tukey method: compute biased cross-covariances between input and output, apply a Hann lag window, then transform via FFT. The transfer function is the cross-spectrum / input auto-spectrum ratio; asymptotic variance formulas (Ljung, 1999) provide per-frequency uncertainty. When multiple trajectories are provided, covariances are ensemble-averaged before forming the ratio, reducing variance by a factor of L without sacrificing frequency resolution.
State-space path. The COSMIC algorithm (Carvalho et al., 2022) identifies discrete-time LTV models x(k+1) = A(k)x(k) + B(k)u(k) by solving a block-tridiagonal regularized least-squares problem in O(N) time. Multiple trajectories — including variable-length sequences — are pooled into the data matrices. When only outputs are observed, Output-COSMIC alternates between state estimation (RTS smoother) and dynamics identification, converging to a joint optimum. Bayesian uncertainty quantification propagates through to frozen transfer functions G(w,k) for direct comparison with non-parametric frequency estimates.
See SPEC.md for the full mathematical derivation, and DESIGN.md for why these methods and this architecture were chosen.
- SPEC.md — Full algorithm specification with mathematical derivations
- EXAMPLES.md — Example-suite specification: binding plant catalog, helper API, and per-example structure that every language port must conform to
- DESIGN.md — Architectural rationale: why the spec-as-contract polyglot structure, why these algorithms, the trade-offs accepted
- Roadmap — Function catalogue, naming convention, and planned features
- COSMIC uncertainty derivation — Bayesian posterior covariance for LTV identification
- COSMIC online recursion — Recursive/streaming formulation of the COSMIC algorithm
- COSMIC automatic tuning — Regularization parameter selection via validation and L-curve
- Output-COSMIC — LTV identification from partial (output-only) observations
- Ljung, L. (1999). System Identification: Theory for the User, 2nd ed. Prentice Hall.
- Blackman, R. B. & Tukey, J. W. (1959). The Measurement of Power Spectra. Dover.
- Carvalho, M., Soares, C., Lourenco, P., and Ventura, R. (2022). "COSMIC: fast closed-form identification from large-scale data for LTV systems." arXiv:2112.04355v2
- Laszkiewicz, P., Carvalho, M., Soares, C., and Lourenco, P. (2025). "The impact of modeling approaches on controlling safety-critical, highly perturbed systems: the case for data-driven models." arXiv:2509.13531
Contributions are welcome via issues and pull requests. See CONTRIBUTING.md for general guidelines and links to language-specific contributing guides.
MIT License. Copyright (c) 2026 Pedro Lourenço. See LICENSE.