Generated reference › Burg Method — Control Systems/Spectral Measurements
kind: generated#block#control-systems-spectral-measurements

Burg Method — Control Systems/Spectral Measurements

B

Control_Systems/Spectral_Measurements/Burg_Method · 1 input / 1 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.

Burg Method

Control Systems / Spectral Measurements

Estimates the power spectral density of a signal frame parametrically: it fits an order-p autoregressive model by Burg's method – exactly as the Burg AR Estimator block does – and evaluates the spectrum that model implies,

Pxx[k] = G·Ts / |A(ej2πk/nfft)|², k = 0 … nfft−1,

where A is the prediction-error filter, G the model's error variance and Ts the time between samples of the series. This is MATLAB's pburg with 'twosided' and a sampling frequency of 1/Ts.

Burg's recursion runs a forward and a backward prediction error down the frame, one sample shorter per order, and picks each reflection coefficient to minimise their summed power: km = −2·Σebef / Σ(ef² + eb²). The coefficients follow by the Levinson order update and the error variance starts at x′x/N, shrinking by (1 − km²) per order.

Ports

  • u – the signal frame x, an [N,1] column; N must be greater than the order p.
  • Pxx – the power spectral density, [nfft,1]: all nfft bins, two-sided, bin k at frequency k/(nfft·Ts). Units of power per hertz when Ts is in seconds.

Parameters

  • Inherit Estimation Order – on or off (default off, as Simulink's). On, the order is p = N−1, the largest the frame allows, and Estimation Order is ignored; off, it is Estimation Order.
  • Estimation Order – p, a whole number of 1 or more. Defaults to 6, as Simulink's does.
  • FFT Length – nfft, the number of frequency bins, a whole number of 1 or more. Defaults to 256. It need not be a power of two. An nfft smaller than p+1 samples the spectrum of A wrapped modulo nfft rather than truncated – measured against the Simulink block, which does the same.
  • Series Sample Time (s) – Ts, the time between samples of the series the frame was cut from, a positive scalar. Defaults to 1. It only scales the answer: halving Ts halves every bin.
  • 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 frame length and the order are baked into the core at export time, and so are the FFT length, Ts and the nfft-point cosine and sine tables.

The three HDL targets are simulation-only: they carry the arithmetic in real and quantize only at the port boundary. The solve divides by a running error power that shrinks at every order, and the spectrum divides by |A|², which a Q16.16 datapath does not survive. The cores simulate correctly and are not offered as synthesizable.

Simulink bridge

Import and export, mapped to dspspect3/Burg Method – the DSP System Toolbox block. "Inherit Estimation Order" to inheritOrd (on/off, one to one), "Estimation Order" to ord, "FFT Length" to fftsize and "Series Sample Time (s)" to Ts.

inheritFFT = off and inheritTs = off are always emitted. With inheritFFT on the Simulink block picks its own length, and with inheritTs on it takes Ts from the frame period divided by N – measured: a 16-sample frame arriving every second scales every bin by exactly 1/16. This block runs one frame per step and has no frame period to divide, so Ts is always the dialog's value. Importing a model whose block inherits its Ts keeps the block's dialog Ts, so its spectrum can come out scaled differently from Simulink's, by exactly that ratio.

"Sampling Time (s)" does not cross. dspspect3/Burg Method 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.
  • An all-zero frame gives NaN, as the Simulink block does – measured on the estimator: A = [1 NaN …], K = NaN, G = NaN, so every bin of the spectrum is NaN. There is no guard to switch on; feed it a frame with energy in it.
  • Two-sided, every bin. Bins 1 … nfft−1 mirror about nfft/2 for a real frame; nothing is folded or doubled. For the one-sided density pburg gives by default, double bins 1 to nfft/2−1.
  • The three HDL targets' output port is Q16.16, whose largest value is 32767. The spectrum is G·Ts/|A|² and nothing keeps A's zeros off the unit circle – a sharp enough peak overflows that port on those three targets while the other seven carry it. Scale Ts down to keep every bin in range; it only scales the answer.
  • Reach for the Burg AR Estimator block for the model itself rather than its spectrum.

Code facts#

FactValue
registered typeControl_Systems/Spectral_Measurements/Burg_Method
familyControl_Systems/Spectral_Measurements
solver environment classICoreBlock_0_Control_Systems_1_Spectral_Measurements_2_Burg_Method
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Spectral_Measurements/Burg_Method/ICoreBlock_0_Control_Systems_1_Spectral_Measurements_2_Burg_Method.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Spectral_Measurements/Burg_Method/ICoreBlock_0_Control_Systems_1_Spectral_Measurements_2_Burg_Method.h
default size on canvas120 × 70 px
ports at insert1 in, 1 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoubleu
2outICoreDoublePxx

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
Inherit Estimation Orderon%~%off~~offinheritOrd
Estimation Order6ord
FFT Length256fftsize
Series Sample Time (s)1Ts

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 pathdspspect3/Burg Method
port-count rulePortsParam::None
SampleTime parameterno — the counterpart defines none; the rate stays on the ICore side
always setinheritFFT = off, inheritTs = off
ICore configSimulink parameterValue translation
Inherit Estimation OrderinheritOrdon → on, off → off
Estimation Orderordpasses through
FFT Lengthfftsizepasses through
Series Sample Time (s)Tspasses through

Caveat (shown to the user): dspspect3/Burg Method has NO SampleTime parameter (verified against the R2026a block dialog), so "Sampling Time (s)" does not cross. 'inheritFFT' and 'inheritTs' are pinned off: this block runs one frame per step and has no frame period to infer Ts from, so a model whose block inherits Ts imports with the dialog's Ts and a spectrum scaled by the ratio of the two

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

Burg Method block — the power spectral density of a signal frame through an AR model fitted by Burg's method MATLAB's pburg (two-sided, fs = 1/Ts) and the DSP System Toolbox block dspspect3/Burg Method, both measured on R2026a first. Pxx[k] = G*Ts / |A(e^{j 2 pi k / nfft})|^2 over ALL nfft bins.

⚠ Ts IS THE TIME BETWEEN SAMPLES OF THE SERIES, and Simulink's default infers it as the FRAME PERIOD / N (measured: a flat ratio of exactly 1/16 on a 16-sample frame every 1 s, 1/24 on 24, exactly 0.25 with inheritTs off and Ts = 0.25). A step here carries one frame and no frame period, so inheritTs is pinned off and Ts is always the dialog's value.

The spectrum is a direct DFT of all p+1 coefficients with nfft-point cosine/sine tables, so an nfft below p+1 samples A wrapped modulo nfft -- which is what the Simulink block does too, measured at nfft = 4, p = 6.

The solve, the spectrum and all ten emitted bodies live in ICoreArEstimationSupport, beside the measurements that justify them; this file is the block's ports, parameters and bridge.

Code export: all ten targets. The three HDL ones are SIMULATION-ONLY real arithmetic -- the solve divides by quantities a Q16.16 datapath cannot carry.

Sample results#

No stimulus produced a sampled output in this rig — Invalid input size at Burg Method block: ICore Blocks/Home/Burg Method. 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 358d2d933 · produced by docsSample --out <folder> --blocks Burg_AR_Estimator Yule_Walker_AR_Estimator Covariance_AR_Estimator Modified_Covariance_AR_Estimator Burg_Method Yule_Walker_Method Covariance_Method Modified_Covariance_Method --steps 60

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