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

LPC To LSF LSP — Control Systems/Signal Modeling

Control_Systems/Signal_Modeling/LPC_To_LSF_LSP · 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.

LPC to LSF/LSP

Control Systems / Signal Modeling

Finds the p line spectral values of the LPC vector A = [1 a1 … ap] by searching for them. The sum and difference polynomials P(z) = A(z) + z−(p+1)A(1/z) and Q(z) = A(z) − z−(p+1)A(1/z) are written as series in x = cosω, a grid of Root Finding Coarse Grid Points values running from x = 1 downwards is walked until one of them changes sign, that interval is halved Root Finding Bisection Refinement times, and a single linear interpolation finishes the value; the search then moves to the other polynomial — their roots interlace — and carries on from where it stopped.

The answer is the search's, not the exact root. At the defaults (64 points, 4 halvings) it sits about 1e−6 from the true root, and that is the number this block reproduces, because it is the number the Simulink block gives. A finer grid and more halvings move it closer.

Ports

  • A – the LPC vector, an [N,1] column with N at least 2; p = N − 1 is the model order.
  • LSP – the p line spectral values, [p,1], in the unit Output names, in increasing frequency.

Parameters

  • Output – the unit of the result:
    • LSP in range (-1 1) (the default, as Simulink's) – the line spectral pairs, cosω itself.
    • LSF normalized in range (0 0.5) – ω/2π.
    • LSF in range (0 pi) – ω in radians.
  • Root Finding Coarse Grid Points – how many grid points the search walks, at least 1; 64 by default. The step is 2 divided by this number, subtracted from 1 in turn.
  • Root Finding Bisection Refinement – how many times an interval that changed sign is halved before the interpolation; 4 by default, and 0 is allowed.
  • Non-Unity First Coefficient – what to do when a0 is not 1:
    • Ignore (the default, as Simulink's) – a0 is not used at all and a1…ap are taken as they are.
    • Normalize – every coefficient is divided by a0 first.
    Simulink's two other choices (warn, error) are not offered: an exported core has nobody to warn.
  • 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 input length, the grid, the number of halvings and the output unit are baked into the core at export time.

The three HDL targets are simulation-only: they carry the arithmetic in real and quantize only at the port boundary. The search divides by the difference of two polynomial values and the two frequency units pass through an arc cosine, neither of which the Q16.16 packages carry. The cores simulate correctly and are not offered as synthesizable.

Simulink bridge

Import and export, mapped to dsplp/LPC to LSF//LSP Conversion – the DSP System Toolbox block (a doubled // is how Simulink writes a slash INSIDE a block name, and the library breaks this block's name over two lines). "Output" to output (one to one, every option), "Root Finding Coarse Grid Points" to NSteps, "Root Finding Bisection Refinement" to NBisects, and "Non-Unity First Coefficient" to error (its first two options, one to one).

RootStatus = off, correction = off and lastLSP = off are always emitted. RootStatus adds a second output port carrying a validity flag, and the other two replace an invalid result with the previous valid one – a stored value this block does not keep. All three stay at their defaults, so the block is the plain one input, one output shape.

"Sampling Time (s)" does not cross. dsplp/LPC to LSF//LSP Conversion defines no SampleTime parameter – 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 search runs on this sample's vector alone.
  • A value the search does not find is left at the bottom of the range – −1 as an LSP, π in radians, 0.5 normalized – exactly as the Simulink block leaves it. It happens when two values of the same polynomial fall inside one grid interval, which a coarse grid or an input that is not a minimum-phase model can both cause; a finer grid finds them.
  • Nothing is refused: any vector of at least two values is accepted, unstable models included, as Simulink accepts them.
  • The inverse is LSF/LSP to LPC, which rebuilds A from these values.

Code facts#

FactValue
registered typeControl_Systems/Signal_Modeling/LPC_To_LSF_LSP
familyControl_Systems/Signal_Modeling
solver environment classICoreBlock_0_Control_Systems_1_Signal_Modeling_2_LPC_To_LSF_LSP
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Signal_Modeling/LPC_To_LSF_LSP/ICoreBlock_0_Control_Systems_1_Signal_Modeling_2_LPC_To_LSF_LSP.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Signal_Modeling/LPC_To_LSF_LSP/ICoreBlock_0_Control_Systems_1_Signal_Modeling_2_LPC_To_LSF_LSP.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
1inICoreDoubleA
2outICoreDoubleLSP

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
OutputLSP in range (-1 1)%~%LSF normalized in range (0 0.5)%~%L…output
Root Finding Coarse Grid Points64NSteps
Root Finding Bisection Refinement4NBisects
Non-Unity First CoefficientIgnore%~%Normalize~~Ignoreerror

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/LPC to LSF//LSP\nConversion
port-count rulePortsParam::None
SampleTime parameterno — the counterpart defines none; the rate stays on the ICore side
always setRootStatus = off, correction = off, lastLSP = off
ICore configSimulink parameterValue translation
OutputoutputLSP in range (-1 1) → LSP in range (-1 1), LSF normalized in range (0 0.5) → LSF normalized in range (0 0.5), LSF in range (0 pi) → LSF in range (0 pi)
Root Finding Coarse Grid PointsNStepspasses through
Root Finding Bisection RefinementNBisectspasses through
Non-Unity First CoefficienterrorIgnore → Ignore, Normalize → Normalize

Caveat (shown to the user): dsplp/LPC to LSF//LSP Conversion has NO SampleTime parameter (verified against the R2026a block dialog), so "Sampling Time (s)" does not cross. 'RootStatus', 'correction' and 'lastLSP' pinned off: the first adds a second output port, the other two replace an invalid result with a remembered one. Only 'Ignore' and 'Normalize' of 'error' are offered - an exported core has nobody to warn

Catalog contract: src/ICoreBlocks/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).

LPC to LSF/LSP block — dsplp's dsplp/LPC to LSF//LSP Conversion, measured on R2026a before it was written Turns the LPC vector A = [1 a1 ... ap] into its p line spectral values by SEARCHING for them: the sum and difference polynomials are written as Chebyshev series in x = cos(w), a grid of NSteps points from 1 downwards is walked until one changes sign, that interval is halved NBisects times, and one linear interpolation finishes the root. The search then moves to the other polynomial and carries on. This answer is NOT the exact root: at the dialog's defaults it sits about 1e-6 from what a root finder gives, which is why it is reproduced rather than computed.

The search, its measured facts and the ten emitted bodies live in ICoreLsfSearchSupport (the arithmetic) and ICoreStatementProgram (the ten spellings); this file is the block's ports, parameters and Simulink bridge.

Code export: all ten targets. The three HDL ones are SIMULATION-ONLY real arithmetic.

Sample results#

LPC To LSF LSP — Sine Wave, [3,1]: amplitudes 1/2/3 at 2 rad/s (tried only because every scalar stimulus was refused)LPC To LSF LSP — Sine Wave, [3,1]: amplitudes 1/2/3 at 2 rad/s (tried only because every scalar stimulus was refused)-1-0.500.51012345t (s)in ICoreDouble-Out-0 [3x1] entry 0out ICoreDouble-Out-0 [2x1] entry 0

Plotted: vector — Sine Wave, [3,1]: amplitudes 1/2/3 at 2 rad/s (tried only because every scalar stimulus was refused)

Category dynamic · sample time 0.1 · 60 steps · commit ae1a5a4f23bf9080195613e8ad1f6128ae5da42d · produced by docsSample --out <folder> --blocks Turbofan_Engine_System EOM_6DOF_Wind_Angles EOM_6DOF_Custom_Variable_Mass_Wind_Angles EOM_6DOF_Simple_Variable_Mass_Wind_Angles Surface_Fit Smoothing_Spline Thin_Plate_Spline LPC_To_LSF_LSP --steps 60 · data docs/generated/samples/Control_Systems__Signal_Modeling__LPC_To_LSF_LSP.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).