Generated reference › Autocorrelation LPC — Control Systems/Signal Modeling
kind: generated#block#control-systems-signal-modeling

Autocorrelation LPC — Control Systems/Signal Modeling

Control_Systems/Signal_Modeling/Autocorrelation_LPC · 1 input / 3 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.

Autocorrelation LPC

Control Systems / Signal Modeling

Computes the linear prediction coefficients of a signal frame: it takes the frame's autocorrelation at lags 0 to p and solves the Yule-Walker system for it, publishing all three answers the recursion produces:

  • A – the prediction-error filter, p+1 entries with A[0] = 1
  • K – the p reflection coefficients
  • P – the prediction error power

This is MATLAB's lpc, including its normalisation – see the Notes, because that is the one number a reader gets wrong.

Ports

  • u – the signal frame, an [N,1] column. N must be greater than the prediction order; the autocorrelation at lag m sums N−m products.
  • A – the prediction-error filter, [p+1,1], always starting at 1.
  • K – the reflection coefficients, [p,1].
  • P – the prediction error power, a scalar.

Parameters

  • Prediction Order – p, the number of coefficients to fit, a whole number of 1 or more and less than the frame length. Defaults to 1, as Simulink's does. Unlike Levinson-Durbin, where the order IS the input's length, here the frame is the signal and the order is a modelling choice about it.
  • Zero Input Handling – on (the default) or off, a division guard rather than a special case: with it on, an all-zero frame gives A = [1 0 … 0], K = 0 and P = 0; with it off the same frame divides by zero and gives NaN throughout.
  • 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. The order and the frame length are baked into the core at export time; the autocorrelation is emitted as p+1 explicit sums and the recursion as a loop.

The three HDL targets are simulation-only: they carry the arithmetic in real and quantize only at the port boundary. The recursion divides by an error power that falls by (1 − K²) at every order, which a Q16.16 divisor does not survive. The cores simulate correctly and are not offered as synthesizable.

Simulink bridge

Import and export, mapped to dsplp/Autocorrelation LPC – the DSP System Toolbox block, not a core Simulink one. "Prediction Order" to order and "Zero Input Handling" to zeroInpHandling.

Three of that block's parameters are always emitted with a fixed value, because this block offers no choice behind them: lpcCoeffOutFcn = A and K, lpcOutP = on and inherit_prediction_order = off. The first two MOVE that block's port list – measured on R2026a – and only that pair gives the 1 input / 3 output shape this block has; the third is what makes order mean anything.

"Sampling Time (s)" does not cross. dsplp/Autocorrelation LPC defines no SampleTime parameter at all – verified against the R2026a block dialog – and set_param on a parameter a block does not define is a hard error that aborts the whole generated script.

Notes

  • Stateless and algebraic: the whole solve runs on this sample's frame. Nothing is carried between steps.
  • P is lpc's g, not levinson's e, and the two differ by the frame length. This block normalises the autocorrelation by N, exactly as lpc does. A and K are scale-invariant and do not notice; P is divided by N. Measured on an eight-sample frame at order 4: 1.1566270367558302 here against 9.2530162940466418 from Levinson-Durbin fed the same frame's raw autocorrelation. If you want the unnormalised error, use that block.
  • The autocorrelation is the biased one – r[m] is the plain sum of N−m products with no 1/(N−m) correction – which is what xcorr(x, p) returns and what lpc uses.
  • K's sign is MATLAB's, and much of the literature writes the reflection coefficient with the other one. Here K[m] equals A's last entry at order m.
  • Reach for Levinson-Durbin instead if what you already have is an autocorrelation sequence rather than a signal frame.

Code facts#

FactValue
registered typeControl_Systems/Signal_Modeling/Autocorrelation_LPC
familyControl_Systems/Signal_Modeling
solver environment classICoreBlock_0_Control_Systems_1_Signal_Modeling_2_Autocorrelation_LPC
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Signal_Modeling/Autocorrelation_LPC/ICoreBlock_0_Control_Systems_1_Signal_Modeling_2_Autocorrelation_LPC.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Signal_Modeling/Autocorrelation_LPC/ICoreBlock_0_Control_Systems_1_Signal_Modeling_2_Autocorrelation_LPC.h
default size on canvas110 × 90 px
ports at insert1 in, 3 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoubleu
2outICoreDoubleA
3outICoreDoubleK
4outICoreDoubleP

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 variableDefaultSimulink parameter
Prediction Order1order
Zero Input Handlingon%~%off~~onzeroInpHandling

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.

supportSupport::Both
Simulink pathdsplp/Autocorrelation LPC
port-count rulePortsParam::None
SampleTime parameterno — the counterpart defines none; the rate stays on the ICore side
always setlpcCoeffOutFcn = A and K, lpcOutP = on, inherit_prediction_order = off
ICore configSimulink parameterValue translation
Prediction Orderorderpasses through
Zero Input HandlingzeroInpHandlingon → on, off → off

Caveat (shown to the user): dsplp/Autocorrelation LPC has NO SampleTime parameter (verified against the R2026a block dialog), so "Sampling Time (s)" does not cross. 'lpcCoeffOutFcn' and 'lpcOutP' are pinned because BOTH move that block's port list - measured, 'A and K' with lpcOutP on is the 1 in / 3 out shape this block has - and 'inherit_prediction_order' is pinned off because that is what makes 'order' mean anything

Catalog contract: src/ICoreBlocks/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h

Description vs code#

The checker has a blind spot here — it could not resolve something (a grouped port bullet, a computed config name), which is reported and never counted as a pass. A reader has to settle it:

  • B0 every stimulus in the sample errored — cross-checks skipped

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).

Autocorrelation LPC block — linear prediction coefficients straight from a signal frame Takes a frame of samples on one port, computes its autocorrelation at lags 0..p, and solves the Yule-Walker system for it — publishing the same three answers Levinson-Durbin does:

A the prediction-error filter, p+1 entries with A[0] = 1 K the p reflection coefficients P the prediction error power

⚠ ITS P IS lpc's g, WHICH IS levinson's e DIVIDED BY THE FRAME LENGTH — and that single factor is the whole difference between this block and Levinson-Durbin beside it. lpc normalises the autocorrelation by N; A and K are scale-invariant and do not notice, and P does. Measured on an eight-sample frame at order 4: this block answers 1.1566270367558302 where Levinson-Durbin fed the same frame's raw autocorrelation answers 9.2530162940466418, a ratio of exactly 8. The two Simulink blocks disagree the same way, and both were driven side by side to establish it rather than reasoned about.

⚠ THREE OUTPUTS RATHER THAN AN OUTPUT-SELECTION MODE, for the same measured reason as its sibling: lpcCoeffOutFcn (A and K | A | K) and lpcOutP BOTH MOVE the Simulink block's port list, and 'A and K' with lpcOutP on is the 1 in / 3 out shape this block has. An ICore port list is registered once and cannot follow a config, so both are pinned.

The order is a CONFIG here, not the port height: the frame is the signal and the order is a modelling choice about it, which is the opposite of Levinson-Durbin where the sequence's length IS the order.

The recursion, the autocorrelation and all ten emitted bodies live in ICoreLinearPredictionSupport, beside the measurements that justify them.

Code export: all ten targets. The three HDL ones are SIMULATION-ONLY real arithmetic, for the reason the shared support states — the recursion divides by an error power that falls by (1 - k^2) at every order.

Sample results#

No stimulus produced a sampled output in this rig — Invalid input size at Autocorrelation LPC block: ICore Blocks/Home/Autocorrelation LPC. That is a fact about the single-block rig, not a verdict on the block: an offline batch fit, a block whose output only appears at onSolverFinish, or one that needs a driven environment cannot be exercised alone.

Category unsampled · sample time 0.1 · 60 steps · commit 9208dc677 · produced by docsSample --out <folder> --blocks Levinson_Durbin Autocorrelation_LPC --steps 60

Sample data: docs/generated/samples/Control_Systems__Signal_Modeling__Autocorrelation_LPC.json