Fit Derivative — Control Systems/Curve Fitting
Control_Systems/Curve_Fitting/Fit_Derivative · 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.
Fit Derivative
Control Systems / Curve Fitting
Differentiates a polynomial given by its coefficients. With the input
in descending powers,
c₀·xL−1 + … + cL−1,
the output is
(L−1)·c₀·xL−2 + … +
1·cL−2 – entry r is
(L−1−r)·cr, and the constant term takes no
part. This is MATLAB's polyder.
It transforms a curve, not a sample. Wire Curve Fitting / Polynomial Fit into it to differentiate a running fit, and Curve Fitting / Evaluate Fit after it to read the slope somewhere.
Ports
- c – the coefficients, descending powers, as a vector of L entries: a column [L,1] or a row [1,L]. A scalar is a constant polynomial.
- dc – the derivative's coefficients, descending, with
L−1 entries and the same orientation as the input. A constant
input gives a single zero, which is what
polyderanswers too.
Parameters
- 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. There is nothing to tune, so nothing is exposed as a parameter on the generated core; the multipliers follow from the input's length alone and are inlined.
The three HDL targets are genuine synthesizable Q16.16, and exact: every multiplier is a whole number, which Q16.16 represents exactly, so the fixed-point columns differ from the software ones only by what the input port already quantized.
Simulink bridge
None (Support::None). polyder is a MATLAB
function, and the Curve Fitting Toolbox ships no Simulink library at all, so
there is no library path a diagram could name. The bridge reports this block
rather than dropping it silently, and it therefore has no parity
testbench; code export verification still covers it across all ten
languages. No configuration of it crosses either, including "Sampling Time (s)",
which has no counterpart to be written to.
Notes
- Algebraic, with no state: the output depends only on the current input.
- It differentiates, it does not evaluate. MATLAB's
differentiate(fitobject, x)answers a value; this answers the derivative CURVE. Follow it with Evaluate Fit for a value, or with a second Fit Derivative for a curvature. - The units are the fitting axis's. Polynomial Fit writes its curve on x = −i·h, so this slope is per unit of that h: per sample at h = 1, per second when h is the sampling period. Nothing here can tell which was meant, so nothing here rescales.
- Exact. The multipliers are the whole numbers L−1 down to 1, so no target introduces a rounding this block is responsible for.
- No state space: the map is linear but changes the signal's HEIGHT, which a merged feed-through D cannot do, so model reduction correctly declines to merge it.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Curve_Fitting/Fit_Derivative |
| family | Control_Systems/Curve_Fitting |
| solver environment class | ICoreBlock_0_Control_Systems_1_Curve_Fitting_2_Fit_Derivative |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Curve_Fitting/Fit_Derivative/ICoreBlock_0_Control_Systems_1_Curve_Fitting_2_Fit_Derivative.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Curve_Fitting/Fit_Derivative/ICoreBlock_0_Control_Systems_1_Curve_Fitting_2_Fit_Derivative.h |
| default size on canvas | 110 × 70 px |
| ports at insert | 1 in, 1 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 | c |
| 2 | out | ICoreDouble | dc |
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#
No config variable beyond the Sampling Time (s) every block carries.
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): differentiating a polynomial by its coefficients is a MATLAB function (polyder), not a Simulink library block -- the Curve Fitting Toolbox ships no Simulink library at all -- so there is no path a diagram could name; the block is reported rather than dropped when a model crosses
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:
B0no sample under docs/generated/samples/ — nothing to cross-check (P8.1)
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).
Fit Derivative -- polyder on a wire Entry r of the output is (L-1-r) * c_r, with c in DESCENDING powers and L the input length. Every multiplier is a whole number, so the map is exact in all ten targets, the three fixed-point ones included -- a whole number is exactly representable in Q16.16 and the product of one with a Q16.16 value loses nothing.
Verified against R2026a: polyder([0.18018728956228861 0.97582972582972149 0.99028980278979795 -0.12171717171717268]) reports [0.54056186868686584 1.951659451659443 0.99028980278979795], which is 3*c0, 2*c1, 1*c2.
Sample results#
No sample run is committed for this block. Samples come from the headless harness (DOCS_PLAN.md P8.1) into docs/generated/samples/; until one exists this block's behaviour is witnessed by the parity and export-verification suites, not by a plot here.