Histogram
SinksThe Histogram block accumulates incoming continuous or discrete signal samples over the course of a simulation run and renders their empirical probability density or frequency distribution as an interactive bar chart. Incoming samples are sorted into discrete bins spanning a user-defined or automatically detected range. It is an essential analytical tool for stochastic process evaluation, sensor noise characterization, Monte Carlo simulation yield analysis, and verification of Gaussian or uniform statistical properties.
Mathematical Model
Given a stream of recorded scalar samples over simulation time , the range interval is divided into contiguous bins:
where the bin width is determined by binMode:
The count for each bin is evaluated as:
where is the indicator function. The normalized empirical probability density estimate for bin is:
When rangeMode = "auto", and expand dynamically to enclose all observed samples. When rangeMode = "manual", samples outside are counted in the boundary bins.
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | in |
Input | array | Required |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
rangeMode |
Range | select | auto |
Auto fits the axis to the data; Manual uses the Min/Max below. |
minValue |
Min Value | number | -5 |
Lower bound (Manual range only). |
maxValue |
Max Value | number | 5 |
Upper bound (Manual range only). |
binMode |
Binning | select | count |
How bins are sized: a fixed number, a fixed step width, or auto. |
bins |
Bin count | number | 20 |
Number of bins (Bin count mode). |
binWidth |
Bin width | number | 1 |
Width/step of each bin (Fixed width mode). |
Usage Examples
Example 1: Inertial Measurement Unit (IMU) Accelerometer Noise Characterization
Validating sensor measurement noise on an industrial IMU. Routing the output of an analog accelerometer channel under zero-motion conditions into a Histogram block with rangeMode = "auto" and binMode = "count" with bins = 30. Over a 10-second simulation run, observing the resulting bell curve allows engineers to confirm Gaussian normality, measure standard deviation , and check for bias asymmetry.
Example 2: Monte Carlo Tolerance Sweep Yield Analysis
Evaluating closed-loop settling time variability across random manufacturing component tolerances. Injecting parameter variations using a RandomNumber block and routing the resulting performance metric to a Histogram with rangeMode = "manual", minValue = 0.0, maxValue = 2.0 s, and binWidth = 0.1 s. The distribution reveals whether of units settle within target specifications.
Remarks & Best Practices
- Accumulative Sink Node: Unlike instantaneous scopes, the Histogram accumulates all samples from simulation start. As run duration increases, the empirical histogram converges toward the true underlying probability density function.
- Range Clamping Behavior: In
manualmode, outliers falling outside are accumulated into the leftmost and rightmost boundary bins rather than being discarded. - Auto-Binning with Freedman-Diaconis: Selecting
binMode = "auto"automatically balances bin resolution against sample variance, preventing oversmoothing in dense datasets or ragged noise in sparse data. - Zero Simulation Latency: Evaluated efficiently via fast integer bin index calculation () directly in WebAssembly.
Related Components
- ScatterPlot: Evaluates joint statistical distributions between two independent signals.
- RandomNumber: Generates uniform and Gaussian pseudo-random variates.
- uPlotDisplay: Displays time-series waveforms as continuous functions of time.
- NumericDisplay: Real-time digital LCD scalar readout.