Window Function — Control Systems/Windows
Control_Systems/Windows/Window_Function · 1 input / 2 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.
Window Function
Control Systems / Windows
Multiplies an incoming frame by a fixed window and publishes both answers:
y[i] = w[i]·u[i], and w itself on a second output.
The window length N is the height of the input port – there is no length parameter, because a window is only ever as long as the frame it multiplies. Eighteen shapes are offered, each computed once when the configuration loads.
Ports
- Input – the frame u to window, of any size [N,m]. N sets the window length; when m > 1 every column is windowed by the same w.
- Output 1 – the windowed frame y, the SAME size [N,m] as the input.
- Output 2 – the window w itself, always an [N,1] column. Leave it unconnected if you only want the product; it costs nothing.
Parameters
- Window Type – which of the eighteen shapes to use. Each is the
function of the same name in MATLAB's Signal Processing Toolbox, reproduced to
better than 1×10−15:
- Bartlett – the triangle that reaches zero at both ends.
- Bartlett-Hann – a blend of the two, flatter than either.
- Blackman – the three-term cosine sum; low sidelobes, wide main lobe.
- Blackman-Harris – the four-term minimum sidelobe sum.
- Bohman – the convolution of two half-cosines; endpoints exactly zero.
- Chebyshev – equiripple sidelobes at the level you ask for, via Chebyshev Sidelobe Attenuation (dB).
- Flat Top – the five-term sum used for amplitude accuracy; it goes negative near the ends, which is correct and surprises people.
- Gaussian – width set by Gaussian Alpha.
- Hamming – the default, and the same 0.54/0.46 pair Simulink uses.
- Hann – the raised cosine.
- Kaiser – the near-optimal family, shaped by Kaiser Beta.
- Nuttall – a four-term sum with continuous derivatives.
- Parzen – the piecewise-cubic (de la Vallée Poussin) window.
- Rectangular – all ones; the block is then a wire on output 1.
- Taylor – radar's window, shaped by Taylor Sidelobes and Taylor Sidelobe Level (dB). It is not normalised to a peak of 1 and routinely exceeds it.
- Triangular – the triangle whose ends are not zero. That is its whole difference from Bartlett, and the pair is the most confusable here.
- Tukey – a flat top with cosine skirts, set by Tukey Ratio.
- DPSS – the first discrete prolate spheroidal sequence, set by DPSS Time-Bandwidth. It is unit energy, not unit peak, so its values are much smaller than the others', and it is the one type with a bound relating its parameter to the window length.
- Sampling – symmetric (the default) or periodic. Periodic divides by N instead of N−1, which is what a window destined for a DFT wants. It applies to the six cosine-sum windows only – Blackman, Blackman-Harris, Flat Top, Hamming, Hann and Nuttall – because those are the only ones MATLAB's own functions accept the flag for; on the other twelve it is ignored and the block says so rather than inventing a second shape.
- Kaiser Beta – the Kaiser shape parameter, a scalar of zero or more; larger is a wider main lobe and lower sidelobes. Defaults to 10, as Simulink's does. Read only by the Kaiser type.
- Chebyshev Sidelobe Attenuation (dB) – how far the equiripple sidelobes sit below the peak, a positive scalar. Defaults to 50. Read only by the Chebyshev type.
- Taylor Sidelobes – the number of nearly-constant-level sidelobes either side of the main lobe, a whole number of 1 or more. Defaults to 4. Read only by the Taylor type.
- Taylor Sidelobe Level (dB) – the maximum sidelobe level relative to the peak, a negative scalar. Defaults to −30. Read only by the Taylor type.
- Gaussian Alpha – the reciprocal of the standard deviation, in half-window widths; larger is narrower. Defaults to 2.5. Read only by the Gaussian type.
- Tukey Ratio – the fraction of the window taken up by the two cosine skirts, between 0 and 1. At 0 it is Rectangular and at 1 it is Hann. Defaults to 0.5. Read only by the Tukey type.
- DPSS Time-Bandwidth – the time-half-bandwidth product NW, a
positive scalar that must be strictly less than half the window length
– the same bound MATLAB's
dpssenforces, and a value at or above it stops the run with a message naming both numbers. Defaults to 2.5, which is valid from a six-sample frame upwards; 4 would be the natural-looking choice and is invalid on every frame of eight or fewer. Read only by the DPSS type. - 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 N window values are baked into the core at export time as literals rather than exposed as tunable parameters: the window is structural, and one whose shape could be retuned on a built core would be a different block.
No emitted core evaluates a window. Not a cosine, not a Bessel function,
not a Chebyshev polynomial, not the eigenproblem behind DPSS – all of that
happens once when the configuration loads, and what reaches a target is N
constants and one multiply per element. That is what keeps the three HDL
targets genuine synthesizable Q16.16 rather than simulation-only real
arithmetic, even for the types whose closed form is transcendental.
Simulink bridge
Import and export, mapped to dspsigops/Window Function – the DSP
System Toolbox block, not a core Simulink one. winmode is always
emitted as Generate and apply window, because that is the one setting whose
port list matches this block's: measured on R2026a, its three values give 1 in / 1
out, 0 in / 1 out and 1 in / 2 out respectively, and only the last carries both of
this block's outputs.
"Window Type" to wintype, "Sampling" to winsamp,
"Kaiser Beta" to beta, "Chebyshev Sidelobe Attenuation (dB)" to
Rs, "Taylor Sidelobes" to numSidelobes and "Taylor
Sidelobe Level (dB)" to sidelobeLevel.
Nine of the eighteen types do not cross, and that is a property of the
Simulink block rather than a gap here: its wintype list holds ten
entries, of which nine match a type offered here (Rectangular crosses as
Boxcar and Triangular as Triang; Hann is also accepted
back under Simulink's alias Hanning). Bartlett-Hann, Blackman-Harris,
Bohman, Flat Top, Gaussian, Nuttall, Parzen, Tukey and DPSS have no entry in that
list, so exporting a model that uses one of them reports the value by name and
leaves the Simulink block at its default rather than substituting a different
window. Gaussian Alpha, Tukey Ratio and DPSS Time-Bandwidth
do not cross either, for the same reason: there is no parameter on the other side
for them to reach.
"Sampling Time (s)" does not cross. dspsigops/Window Function 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 in MATLAB that aborts the whole generated script.
Notes
- Stateless and algebraic: the output depends only on this sample's input and on the configuration. There is no memory and nothing to seed.
- Bartlett vs. Triangular. Both are triangles and they are not the same one: Bartlett divides by N−1 and reaches exactly zero at both ends; Triangular divides by N (even) or N+1 (odd) and does not. At N = 8 the first entry is 0 and 0.125 respectively.
- Two windows are not normalised to a peak of 1, deliberately, because their defining functions are not: Taylor exceeds 1 near the centre, and DPSS carries unit energy so its peak falls as N grows. Scaling either to match the others would make this block disagree with the function it names.
- Flat Top goes negative. Its five-term sum dips below zero on the way to the ends. That is the window, not a defect, and it is why an amplitude-accurate window is a poor choice for anything that assumes a non-negative taper.
- Every one of the eighteen is exactly 1 at a window length of one, which
is what MATLAB's functions return there too – measured on all seventeen that
accept N = 1. DPSS is the exception on both sides: its parameter bound cannot be
met at N = 1, so this block refuses it and so does
dpss. - No length parameter, by design. Simulink's block has one because it can also run as a source; this one always has an input, so N comes from the port and the two cannot disagree.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Windows/Window_Function |
| family | Control_Systems/Windows |
| solver environment class | ICoreBlock_0_Control_Systems_1_Windows_2_Window_Function |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Windows/Window_Function/ICoreBlock_0_Control_Systems_1_Windows_2_Window_Function.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Windows/Window_Function/ICoreBlock_0_Control_Systems_1_Windows_2_Window_Function.h |
| default size on canvas | 110 × 80 px |
| ports at insert | 1 in, 2 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 | u |
| 2 | out | ICoreDouble | y |
| 3 | out | ICoreDouble | w |
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 |
|---|---|---|
Window Type | typeComboSpec() | wintype |
Sampling | symmetric%~%periodic~~symmetric | winsamp |
Kaiser Beta | 10 | beta |
Chebyshev Sidelobe Attenuation (dB) | 50 | Rs |
Taylor Sidelobes | 4 | numSidelobes |
Taylor Sidelobe Level (dB) | -30 | sidelobeLevel |
Gaussian Alpha | 2.5 | not crossed |
Tukey Ratio | 0.5 | not crossed |
DPSS Time-Bandwidth | 2.5 | not crossed |
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::Both |
| Simulink path | dspsigops/Window Function |
| port-count rule | PortsParam::None |
SampleTime parameter | no — the counterpart defines none; the rate stays on the ICore side |
| deliberately not crossed | Gaussian Alpha, Tukey Ratio, DPSS Time-Bandwidth |
| always set | winmode = Generate and apply window |
| ICore config | Simulink parameter | Value translation |
|---|---|---|
Window Type | wintype | Bartlett → Bartlett, Blackman → Blackman, Rectangular → Boxcar, Chebyshev → Chebyshev, Hamming → Hamming, Hann → Hann, Hann → Hanning, Kaiser → Kaiser, Taylor → Taylor, Triangular → Triang |
Sampling | winsamp | symmetric → Symmetric, periodic → Periodic |
Kaiser Beta | beta | passes through |
Chebyshev Sidelobe Attenuation (dB) | Rs | passes through |
Taylor Sidelobes | numSidelobes | passes through |
Taylor Sidelobe Level (dB) | sidelobeLevel | passes through |
Caveat (shown to the user): dspsigops/Window Function has NO SampleTime parameter (verified against the R2026a block dialog), so "Sampling Time (s)" does not cross. 'winmode' is pinned to 'Generate and apply window' because that is the one value whose port list matches this block's - measured, its three values give 1 in/1 out, 0 in/1 out and 1 in/2 out. Nine of this block's eighteen window types have no entry in Simulink's wintype list (Bartlett-Hann, Blackman-Harris, Bohman, Flat Top, Gaussian, Nuttall, Parzen, Tukey, DPSS) and are reported by name on export rather than substituted
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).
Window Function block — y = w .* u, with w one of eighteen measured window shapes Multiplies an incoming frame by a fixed window and publishes BOTH answers:
y[i,j] = w[i] * u[i,j] the windowed frame, same size as the input w[i] the window itself, an [N,1] column
N is the HEIGHT OF THE INPUT PORT. There is no length parameter: a window is only ever as long as the frame it multiplies, and taking the length from the port is what stops the two disagreeing.
⚠ TWO OUTPUTS RATHER THAN AN OPERATION MODE, AND THAT IS A MEASUREMENT ABOUT SIMULINK. dspsigops/Window Function has a
winmodeparameter with three values, and its PORT LIST moves with it -- measured: 'Apply window to input' is 1 in / 1 out, 'Generate window' is 0 in / 1 out, and 'Generate and apply window' is 1 in / 2 out. This block is the third of those, always, withwinmodepinned as a fixed parameter: an ICore block's port list is registered once and does not move with a config, and an unconnected output costs nothing, so offering both answers is strictly more than offering a switch between them. It is the same choice Gaussian RF Pulse made for its three outputs.⚠ EVERY ONE OF THE EIGHTEEN WAS MEASURED AGAINST R2026a BEFORE IT WAS WRITTEN, AND THE TEXT BELOW IS THE TEXT THAT WAS CHECKED. The procedure was: dump all eighteen from MATLAB at N = 8, 9 and 16 (odd and even, symmetric and periodic where the function accepts it); prototype each in Python and diff; transcribe to the C++ below; compile THAT TEXT standalone and diff it again. Worst disagreement across all 72 vectors: 9.2e-16. The step earns its keep -- the Taylor sign factor (-1)^(m+1) went in inverted and scored 1.31 against R2026a, a perfectly plausible window that is not taylorwin, and no later suite would have caught it because export verification compares ICore against ICore.
⚠ NINE OF THE EIGHTEEN HAVE NO SIMULINK COUNTERPART. dspsigops/Window Function offers ten types (Bartlett, Blackman, Boxcar, Chebyshev, Hamming, Hann, Hanning, Kaiser, Taylor, Triang, plus User defined); the other nine here are Signal Processing Toolbox FUNCTIONS with no entry in that list. The catalog's enum table therefore maps nine values and no more, and a model exporting one of the other nine gets the bridge's own warning naming the value -- "has no Simulink equivalent; left at default" -- rather than a silently wrong window.
NOTHING HERE REACHES A GENERATED CORE. The weights are computed once, at config load, and all ten backends inline them as literals: no emitted core evaluates a cosine, a Bessel function, a Chebyshev polynomial or an eigenproblem. That is what keeps the three HDL targets genuine synthesizable Q16.16 rather than simulation-only real arithmetic.
Sample results#
| t | in ICoreDouble-Out-0 | out ICoreDouble-Out-0 | out ICoreDouble-Out-1 |
|---|---|---|---|
| 0 | -2 | -2 | 1 |
| 0.4 | 0.5 | 0.5 | 1 |
| 0.8 | -2 | -2 | 1 |
| 1.2 | 0.5 | 0.5 | 1 |
| 1.6 | -2 | -2 | 1 |
| 2 | 0.5 | 0.5 | 1 |
| 2.4 | -2 | -2 | 1 |
| 2.8 | 0.5 | 0.5 | 1 |
| 3.2 | -2 | -2 | 1 |
| 3.6 | 0.5 | 0.5 | 1 |
| 4 | -2 | -2 | 1 |
| 4.4 | 0.5 | 0.5 | 1 |
| 4.8 | -2 | -2 | 1 |
| 5.2 | 0.5 | 0.5 | 1 |
Every 4th of 60 samples, from the table stimulus.
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 … 1 |
ramp | Ramp: slope 1 from t = 0 | 0 … 5.8 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | -1 … 0.9996 |
step | Step: 0 -> 1 at t = 1 s | 0 … 1 |
Plotted: table — Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample
Category static · sample time 0.1 · 60 steps · commit 8a7038c82 · produced by docsSample --out <folder> --blocks Window_Function --steps 60 · data docs/generated/samples/Control_Systems__Windows__Window_Function.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).