Skip to content

sidCompare

Python equivalent: sid.compare

Compare model predicted output to measured data.

result = sidCompare(model, y, u)
result = sidCompare(model, y, u, 'InitialState', x0)
sidCompare(model, y, u, 'Plot', true)

Simulates the model's predicted output given the input signal and compares it to the measured output using the NRMSE fit metric.

Inputs

Name Description
model Result struct from any sid estimator (see sidResultTypes).
Freq-domain (§1): requires .Response, .Frequency, .SampleTime
State-space (§4/§5): requires .A, .B, .StateDim, .InputDim,
.DataLength
y (N x ny) measured output, or (N+1 x p x L) state data for COSMIC
u (N x nu) input, or (N x q x L) for multi-trajectory COSMIC

Name-value options

Name Description
'InitialState' (p x 1) initial state for state-space simulation
(default: first row of y)
'Plot' Display comparison plot (default: true if nargout==0)

Outputs

Name Description
result.Predicted (N x ny) model-predicted output
result.Measured (N x ny) measured output (copy)
result.Fit (1 x ny) NRMSE fit percentage per channel
result.Residual (N x ny) residual (y - y_pred)
result.Method char, method of the source model

Examples

% Compare frequency-domain model to data
G = sidFreqBT(y, u);
result = sidCompare(G, y, u);
% Visual comparison with plot
sidCompare(G, y, u, 'Plot', true);

Fit metric

fit = 100 * (1 - ||y - y_pred|| / ||y - mean(y)||) 100% = perfect, 0% = no better than mean, negative = worse than mean.

Specification

(Model output comparison — not yet in SPEC.md)

See also

sidResidual, sidFreqBT, sidLTVdisc

Changelog

  • 2026-03-29: First version by Pedro Lourenço.