Recursive ARMAX — System Identification/Recursive
System_Identification/Recursive/Recursive_ARMAX · 2 input / 4 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text
Description#
The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.
Recursive ARMAX
System Identification / Recursive
Identifies an ARMAX model online by extended least squares:
A(q)y[k] = B(q)u[k] + C(q)e[k]
Unlike an ARX estimator, this one also models the colour of the noise through C(q). It does so by putting its own past prediction errors into the regressor:
φ[k] = [ −y[k−1] … −y[k−na], u[k] … u[k−nb], e[k−1] … e[k−nc] ]
which is why it is called pseudo-linear regression: the last segment is not measured data but a quantity the estimator itself produces. The parameter vector is then moved by an ordinary forgetting-factor recursive least-squares step.
Reach for it when the disturbance on your plant is not white – when an ARX fit leaves structure in its residuals. Where ARX would bias the A and B estimates to explain that structure, ARMAX gives the noise its own polynomial to live in.
Ports
- u – the input, a [1,1] scalar per step.
- y – the measured output, a [1,1] scalar per step.
- A – the estimated [na,1] denominator coefficients a1…ana. The leading 1 of A(q) is not estimated and is not on the port.
- B – the estimated [nb+1,1] numerator coefficients b0…bnb. nb+1, not nb: b0 is the direct feedthrough term.
- C – the estimated [nc,1] noise coefficients c1…cnc. As with A, the leading 1 is not estimated.
- e – the current a priori prediction error, a [1,1] scalar. It is the residual the regressor will carry forward, so watching it is how you see the estimator converge.
Parameters
- A Order – na ≥ 1, the number of estimated denominator coefficients.
- B Order – nb ≥ 0. The B port is one longer than this.
- C Order – nc ≥ 1, the length of the noise polynomial. This is the parameter that distinguishes the block from an ARX estimator; at nc = 0 it would be one.
- Forgetting Factor – λ in (0, 1]. Below 1 the estimator discounts old data and can track a changing plant; at exactly 1 it weights the whole history equally and settles. ⚠ A small λ on quiet data makes the covariance grow without bound – the classic estimator wind-up.
- Initial Covariance – P0, the diagonal the covariance starts from. Large means "distrust the initial guess", so the first samples move θ a long way; small means the opposite.
- Initial Parameters – the seed for θ. A single value broadcasts to every entry; a vector of the full length na+nb+1+nc is taken in order.
- Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. Each generator re-implements the recursion step for step, with the three orders – and therefore every array bound – fixed at export time from the configuration. θ is seeded from the config in every backend, never from the running estimate, which by export time has already moved.
The three HDL targets are simulation-only, this family's standing
rule: the update divides once per sample and the covariance spans the decades
between its seed and its settled value, and neither belongs in a Q16.16 datapath.
They carry the recursion in real arithmetic and quantize only at the
port boundary.
Simulink bridge
None. Simulink's recursive estimators belong to the System
Identification Toolbox, which is not installed here, so a mapping could not be
parity-verified even if it were written. The bridge reports the block rather than
dropping it silently, and it has no parity testbench, which is the
documented consequence of Support::None. Code export verification
still covers it across all ten languages.
Notes
- Stateful and inherently discrete: θ, the covariance and three
history buffers advance once per sample, so the block declares
setDiscreteOnlyBlock(true). - ⚠ The update ORDER is part of the definition. u[k] enters the regressor at once (b0 is a feedthrough term) while y and e enter one step later, so the histories are pushed at two different points in the step. A backend that shifted one of them early or late still produces a well-formed recursion – it just estimates a different system.
- Convergence is not guaranteed, and that is a property of extended least squares rather than of this implementation: the regressor contains a quantity the estimator generates, so the recursion is only pseudo-linear. It behaves when the input is persistently exciting and C(q) is stably invertible.
Code facts#
| Fact | Value |
|---|---|
| registered type | System_Identification/Recursive/Recursive_ARMAX |
| family | System_Identification/Recursive |
| solver environment class | ICoreBlock_0_System_Identification_1_Recursive_2_Recursive_ARMAX |
| source | src/ICoreSDK/ICoreBlockLibrary/Blocks/System_Identification/Recursive/Recursive_ARMAX/ICoreBlock_0_System_Identification_1_Recursive_2_Recursive_ARMAX.cpp |
| header | src/ICoreSDK/ICoreBlockLibrary/Blocks/System_Identification/Recursive/Recursive_ARMAX/ICoreBlock_0_System_Identification_1_Recursive_2_Recursive_ARMAX.h |
| default size on canvas | 110 × 96 px |
| ports at insert | 2 in, 4 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | in | ICoreDouble | — |
| 2 | in | ICoreDouble | — |
| 3 | out | ICoreDouble | — |
| 4 | out | ICoreDouble | — |
| 5 | out | ICoreDouble | — |
| 6 | out | ICoreDouble | — |
Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.
Configuration variables#
| Config variable | Default | Simulink parameter |
|---|---|---|
A Order | 2 | — |
B Order | 1 | — |
C Order | 1 | — |
Forgetting Factor | 0.98 | — |
Initial Covariance | 10000 | — |
Initial Parameters | 0 | — |
Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.
Simulink bridge#
| support | Support::None |
| Simulink path | — |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Caveat (shown to the user): Simulink's recursive estimators belong to the System Identification Toolbox, which is not installed on this machine, so the mapping could not be parity-verified even if it were written. Use recursiveARMAX on the Simulink side with the same orders
Catalog contract: src/ICoreSDK/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h
Description vs code#
The lists agree. check_block_descriptions.py finds no disagreement between the description's Ports, Parameters, Code export and Simulink bridge lists and the code's.
The verdict above is
tools/docs/check_block_descriptions.py(P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.
File banner (developer view)#
The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).
Recursive ARMAX — extended least squares (pseudo-linear regression) A(q)y = B(q)u + C(q)e phi[k] = [ -y[k-1..k-na] , u[k..k-nb] , e[k-1..k-nc] ]'
The last segment is the estimator's OWN past residuals, which is what makes this ARMAX and not the ARX-shaped recursion Recursive_IIR_Identification runs. See the header for the exact six-step update order every backend reproduces, and for why only one update law is offered.
Sample results#
The same rig also ran:
| Stimulus | What it is | Output range |
|---|---|---|
impulse | Impulse: one sample of 1 at k = 5, 0 elsewhere (Repeating Sequence Stair) | 0 … 0 |
ramp | Ramp: slope 1 from t = 0 | -0.009244 … 0 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | -0.002362 … 0 |
table | Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample | -2.893e-5 … 0 |
Plotted: step — Step: 0 -> 1 at t = 1 s
Category dynamic · sample time 0.1 · 60 steps · commit ccf005c8 · produced by docsSample --out <folder> --steps 60 · data docs/generated/samples/System_Identification__Recursive__Recursive_ARMAX.json · the SVG is generated from those numbers by tools/docs/plot_svg.py, so it is a run and not a drawing (R-D10).