Demux
Signal RoutingThe Demux block splits an incoming vector or bus signal into separate scalar output lines, or distributes a single input signal simultaneously across multiple downstream blocks without drawing overlapping connection lines.
It is widely used in complex control architectures to unpack state vectors from multi-variable state-space models, distribute shared reference clocks, and route multi-channel sensor arrays cleanly across the canvas.
Mathematical Model
When receiving an incoming vector signal matching , each output port emits the corresponding vector element:
When receiving a scalar signal , the block acts as an active signal fan-out distributor, broadcasting the identical scalar value across all configured output terminals:
Signal routing occurs with zero phase lag and zero sample-time transport delay:
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| → In | in |
Vector | vector | Required |
| ← Out | out |
Element | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
numOutputs |
Number of Outputs | number | 2 |
Usage Examples
Example 1: Multi-State Vector Element Unpacking
Unpacking a 3-element state vector from a StateSpace mechanical plant model. Connecting the vector wire to Demux configured with numOutputs = 3 produces three dedicated scalar wires for position, velocity, and acceleration, allowing individual scope monitoring and state-feedback gain tuning.
Example 2: Clean Signal Fan-Out Without Wire Crossings
Distributing a central speed setpoint command simultaneously to a velocity controller, a feedforward compensator, and a data-logging display. Setting numOutputs = 3 allows each downstream subsystem to receive the command along straight, collinear connection paths without cluttering the diagram with intersecting wires.
Remarks & Best Practices
- Zero-Latency Pass-Through: Signal extraction and distribution execute instantaneously within the same simulation timestep with zero numerical error.
- Dynamic Port Resizing: Adjusting
numOutputsdynamically updates the block dimensions and port handles on the diagram canvas. - Unconnected Output Handling: Unconnected output ports are safely ignored by the execution engine, consuming no simulation cycles or memory buffers.
- Vector and Scalar Flexibility: Transparently decomposes typed vector arrays or broadcasts scalar signals depending on the input wire type.
Related Components
- Mux: Combines multiple scalar signals into a bundled vector.
- Selector: Extracts specific indexed elements or subarrays from an input vector.
- Goto: Transmits signals wirelessly across canvas boundaries without visible wires.
- uPlotDisplay: Multi-channel waveform scope for monitoring multiple signals.