Generated reference › Cross Wigner Ville Distribution — Control Systems/Time Frequency
kind: generated#block#control-systems-time-frequency

Cross Wigner Ville Distribution — Control Systems/Time Frequency

XWVD

Control_Systems/Time_Frequency/Cross_Wigner_Ville_Distribution · 2 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.

Cross Wigner-Ville Distribution

Control Systems / Time Frequency

The cross Wigner-Ville distribution of two streams, one time column per sample – MATLAB's xwvd of the last N samples of each:

W[r] = Σm=0..N−1 xi(N+m)·yi*(N−m)·e+i2π(r+1)m/(2N),   r = 0 … N−1

where xi and yi are the analytic signals of the two windows interpolated onto a half-sample grid, exactly as xwvd forms them (see Notes). The output is column N+1 of xwvd of the two windows – the time at their middle – and it is complex.

Ports

  • x – the first signal. Scalar.
  • y – the second signal, the one conjugated in the product. Scalar, sampled with x.
  • Re – the real part of the distribution at one instant, [N, 1]: row r is the frequency (r+1)·fs/(2N).
  • Im – its imaginary part, the same size and the same rows.

Parameters

  • Window Length – N, the samples of each signal the distribution is formed over and the number of output rows: an even whole number from 4 to 16. Even because xwvd pads an odd record to the next even length; bounded above because every entry is a bilinear form of the two windows, unrolled at export, and the cost grows as N³.
  • Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.

Frames and timing

Once the windows have filled – from sample N − 1, counting from 0 – the output at sample j is column N+1 of xwvd(x(j−N+1 : j), y(j−N+1 : j)): time N/2 of the windows, N/2 − 1 samples behind the newest inputs. It is recomputed on every sample; before the windows fill it is all zeros.

Code export

All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. The analytic signals, the interpolation, the lag products and the transform are folded into one fixed bilinear form per output entry at export time, so a generated core is products and sums only. The window length is structural: re-export after changing it. Java puts each entry in its own method, because a whole distribution at N = 16 is several thousand products and a Java method is capped at 64 KB.

The three HDL targets are genuine Q16.16 and synthesizable: each product of an x sample and a y sample is formed once per tick and every entry is a multiply-accumulate over those products. Scale both signals into roughly ±1 first.

Simulink bridge

None (Support::None). xwvd is a Signal Processing Toolbox function and that toolbox ships no Simulink library, so there is no 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.

Notes

  • It is not Wigner-Ville Distribution with a second input, and xwvd(x, x) is not wvd(x): on an 8-sample record the two differ by 10.1 on a scale of 10, and the first carries imaginary parts up to 5.79. xwvd takes the unpadded analytic signal, interpolates it linearly to half samples, conjugates it (MATLAB transposes the interpolated row with ', which conjugates), and sums over non-negative lags only. This block reproduces all four, measured against R2026a to 7.1×10−15 over every window of a 30-sample record (the source banner carries the numbers).
  • Stateful, and discrete by nature: a register of the last N samples of each signal and a fill count.
  • Not reproduced: xwvd's 'smoothedPseudo' windows, its NumFrequencyPoints and MinThreshold options, and complex inputs. The half-sample columns are not published.
  • MATLAB's frequency labels differ from the rows: xwvd's second output names row r r·fs/(2(N−1)), while a tone at fs/4 peaks on row N/2 − 1, the frequency (r+1)·fs/(2N). The matrix is MATLAB's either way.
  • No state space. The distribution is bilinear in the two inputs, so model reduction correctly declines to merge it.

Code facts#

FactValue
registered typeControl_Systems/Time_Frequency/Cross_Wigner_Ville_Distribution
familyControl_Systems/Time_Frequency
solver environment classICoreBlock_0_Control_Systems_1_Time_Frequency_2_Cross_Wigner_Ville_Distribution
sourcesrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Time_Frequency/Cross_Wigner_Ville_Distribution/ICoreBlock_0_Control_Systems_1_Time_Frequency_2_Cross_Wigner_Ville_Distribution.cpp
headersrc/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Time_Frequency/Cross_Wigner_Ville_Distribution/ICoreBlock_0_Control_Systems_1_Time_Frequency_2_Cross_Wigner_Ville_Distribution.h
default size on canvas160 × 90 px
ports at insert2 in, 2 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoublex
2inICoreDoubley
3outICoreDoubleRe
4outICoreDoubleIm

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
Window Length8—

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::None
Simulink path—
port-count rulePortsParam::None
SampleTime parameteryes

Caveat (shown to the user): xwvd is a Signal Processing Toolbox function, not a Simulink library block -- that 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 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).

Cross Wigner-Ville Distribution -- MATLAB's xwvd, one time column per sample W[r] = SUM(m = 0..N-1) xi(N+m) conj(yi(N-m)) e^(+j 2 pi (r+1) m / (2N)), r = 0 .. N-1

over the last N samples of x and y: the output at sample k is column N+1 of xwvd(x(k-N+1 : k), y(k-N+1 : k)), published as its real and its imaginary part.

MEASURED AGAINST R2026a before a line was written. xwvd is NOT wvd with a second signal, and every one of these was a surprise that a transcription of the textbook definition gets wrong:

  • The analytic signal is hilbert() of the window as it is -- NOT zero-padded to 2N as wvd's

is (signalwavelet.internal.analyticSignal(x) equals hilbert(x) to 0).

  • It is interpolated LINEARLY onto a half-sample grid, 2N-1 points plus a trailing zero, and

the result is CONJUGATED: parsewvdOptions writes interp1(...)' and ' is the conjugate transpose of interp1's row. Without that conjugate the formula misses by 9.93 on a scale of 6.75; with it the whole 8-by-16 matrix is reproduced to 0.

  • The lag is ONE-SIDED (m >= 0 only) and the rows are the upper half of a 2N-point transform,

flipped, so row r is frequency (r+1)*fs/(2N) -- a tone at fs/4 peaks on row N/2 - 1. MATLAB's second output labels the same rows linspace(0, fs/2, N).

  • So the output is COMPLEX, and xwvd(x, x) is not wvd(x): on the 8-sample record below they

differ by 10.1 on a scale of 10, and xwvd(x, x) carries imaginary parts up to 5.79.

  • For x = [1.2 0.7 2.5 0.3 0.12 0.8 1.1 -0.22] and y = [0.3 -1.1 0.6 0.9 -0.4 1.3 0.2 0.75],

column 9 of xwvd(x, y) has real part [2.42228886659 -1.42354046970 -3.37419842419 -0.94895066274 2.52185779143 1.57786682562 -1.05465268564 0.11763267730] and imaginary part [1.73529962647 2.98409846451 -0.40514361790 -3.27140794281 -1.79904025897 1.60392100617 0.68417232376 -0.77944751379]. The block's bilinear forms reproduce every window of a 30-sample record to 2.7e-15 at N = 8 and 7.1e-15 at N = 16.

Support::None: xwvd is a Signal Processing Toolbox FUNCTION and that toolbox ships no Simulink library, so there is no counterpart to bridge to or run a parity testbench against.

Sample results#

Cross Wigner Ville Distribution — Step: 0 -> 1 at t = 1 sCross Wigner Ville Distribution — Step: 0 -> 1 at t = 1 s0246012345t (s)in ICoreDouble-Out-0in ICoreDouble-Out-0out ICoreDouble-Out-0 [8x1] entry 0out ICoreDouble-Out-1 [8x1] entry 0

The same rig also ran:

StimulusWhat it isOutput range
impulseImpulse: one sample of 1 at k = 5, 0 elsewhere (Repeating Sequence Stair)-0.01072 … 0.9785
rampRamp: slope 1 from t = 00 … 64.33
sineSine Wave: amplitude 1, 2 rad/s, no phase, no bias0 … 3.161
tableRepeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample-4.387 … 13.29

Plotted: step — Step: 0 -> 1 at t = 1 s

Category dynamic · sample time 0.1 · 60 steps · commit 875fdbf564cf31a145283edf6a75dc1d64d1090a · produced by docsSample --out <folder> --blocks Wigner_Ville_Distribution Cross_Wigner_Ville_Distribution Inverse_STFT Fourier_Synchrosqueezed_Transform Time_Frequency_Ridges Frequency_Domain_Filter_Identification Fill_Gaps EOM_6DOF_ECEF_Quaternion EOM_6DOF_Custom_Variable_Mass_ECEF_Quaternion EOM_6DOF_Simple_Variable_Mass_ECEF_Quaternion ECI_To_ECEF_Rotation_Matrix ECI_Position_To_LLA LLA_To_ECI_Position ECI_Position_To_AER --steps 60 · data docs/generated/samples/Control_Systems__Time_Frequency__Cross_Wigner_Ville_Distribution.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).