Skip to content

sidModelOrder

Python equivalent: sid.model_order

Estimate model order from frequency response via Hankel SVD.

[n, sv] = sidModelOrder(result)
[n, sv] = sidModelOrder(result, 'Horizon', r)
[n, sv] = sidModelOrder(result, 'Threshold', tau)
sidModelOrder(result, 'Plot', true)

Estimates the state dimension n of a linear system from the singular value decomposition of a block Hankel matrix built from the impulse response coefficients. The impulse response is obtained via IFFT of the frequency response estimate.

Inputs

Name Description
result Struct from any sidFreq* function, with at least:
.Response (n_f x n_y x n_u) complex frequency response
.Frequency (n_f x 1) frequency vector, rad/sample
For time-series (no input), uses .NoiseSpectrum instead.

Name-value options

Name Description
'Horizon' Block Hankel prediction horizon r.
Default: min(floor(N_imp/3), 50).
'Threshold' If specified, count singular values with sigma_k/sigma_1
above this threshold instead of gap detection.
Default: [] (use gap method).
'Plot' If true, display bar chart of singular values with
the detected model order marked. Default: false.

Outputs

Name Description
n Estimated model order (state dimension).
sv Struct with fields:
.SingularValues (m x 1) singular values of the Hankel matrix
.Horizon scalar, prediction horizon used

Examples

% Automated model order detection
G = sidFreqBT(y, u);
[n, sv] = sidModelOrder(G);
% Visual inspection
sidModelOrder(G, 'Plot', true);
% Use with output-COSMIC
p_y = size(y, 2);
H = [eye(p_y), zeros(p_y, n - p_y)];
res = sidLTVdiscIO(y, u, H, 'Lambda', 1e5);

Algorithm

  1. Compute impulse response g(k) via IFFT of the frequency response.
  2. Build block Hankel matrix H with r block-rows and r block-cols. For MIMO systems, each entry g(k) is an n_y x n_u block.
  3. Compute SVD of H: [U, S, V] = svd(H).
  4. Detect model order as argmax_k (sigma_k / sigma_{k+1}). With threshold tau: n = number of sigma_k / sigma_1 > tau.

References

Kung, S.Y. "A new identification and model reduction algorithm via singular value decomposition." Proc. 12th Asilomar Conference, 1978.

Specification

SPEC.md §8.12 — Output-COSMIC: Partial State Observation

See also

sidFreqBT, sidFreqETFE, sidLTVdiscIO

Changelog

  • 2026-04-01: First version by Pedro Lourenco.