🔀

Mux

Signal Routing
Run the live example Free · no sign-up · runs in your browser

The Mux (Multiplexer) block combines multiple scalar input signals into a single multi-dimensional vector signal. It is widely used in control diagrams to bundle independent scalar measurement channels before feeding them into vector-valued blocks—such as StateSpace models, MIMO controllers, Kalman filters, and multi-channel scopes. The block provides a configurable number of input ports (from 2 up to 10) and introduces zero numerical distortion or computational delay into the signal path.

Mathematical Model

The block takes MM incoming real-valued scalar signals u1(t),u2(t),…,uM(t)u_1(t), u_2(t), \dots, u_M(t), where M=numInputsM = \text{numInputs}, and concatenates them into an ordered MM-dimensional column vector y(t)\mathbf{y}(t):

y(t)=[u1(t)u2(t)⋮uM(t)]∈RM\mathbf{y}(t) = \begin{bmatrix} u_1(t) \\ u_2(t) \\ \vdots \\ u_M(t) \end{bmatrix} \in \mathbb{R}^M

If an individual input port is left unconnected, its corresponding vector element is assigned the default floating-point value of zero:

uk(t)=0.0if port k is unconnectedu_k(t) = 0.0 \quad \text{if port } k \text{ is unconnected}

Inputs & Outputs

Direction ID Label Type Status
→ In in In number Required
← Out out Vector vector Output

Parameters

Parameters Label Type Default Description
numInputs Number of Inputs number 2

Usage Examples

Example 1: Consolidating Triaxial Accelerometer Signals for State-Space Plants

In an inertial navigation simulation, three independent scalar accelerometer sensors measure specific forces along orthogonal body axes (axa_x, aya_y, aza_z). Routing these three signals into a Mux block with numInputs = 3 produces a clean 3×13\times 1 vector signal a=[ax,ay,az]T\mathbf{a} = [a_x, a_y, a_z]^T that directly feeds the input port of a 3D StateSpace navigation kinematic model.

Example 2: Bundling Multi-Channel Telemetry for Vector Display

Collecting temperature, pressure, and motor current from separate physical plant subsystems. A Mux block configured with numInputs = 3 bundles the signals into a single compound connection, which routes cleanly into a multi-channel uPlotDisplay scope without cluttering the diagram canvas with parallel wire crossings.

Remarks & Best Practices

  • Vector Concatenation vs. Summation: The Mux block performs purely geometric vector assembly [u1,u2,…,uM]T[u_1, u_2, \dots, u_M]^T. It does not sum or add input values; to compute the arithmetic sum of multiple signals, use the Sum block.
  • Scalar-Only Inputs: All connected input lines must be scalar numbers. Feeding vector signals into individual input ports of a Mux block is not supported; use multiple Mux stages or dedicated bus routing.
  • Unconnected Input Handling: Any unconnected input port defaults safely to 0.00.0, preventing null pointer exceptions during simulation execution.
  • Zero Computation Latency: Implemented as a direct in-memory array concatenation in WebAssembly with zero transport delay or phase lag.

Related Components

  • Demux: Separates a vector signal back into individual scalar signals.
  • Sum: Computes the algebraic sum of multiple input signals.
  • StateSpace: Continuous multi-input multi-output dynamic system.
  • uPlotDisplay: Multi-channel waveform oscilloscope.