Using Simulink    
Switch

Switch between two inputs.

Library

Nonlinear

Description

The Switch block propagates one of two inputs to its output depending on the value of a third input, called the control input. If the signal on the control (second) input is greater than or equal to the Threshold parameter, the block propagates the first input; otherwise, it propagates the third input. This figure shows the use of the block ports.

To drive the switch with a logic input (i.e., 0 or 1), set the threshold to 0.5.

Data Type Support

A Switch block accepts real- or complex-valued signals of any data type as switched inputs (inputs 1 and 3). Both switched inputs must be of the same type. The block output signal has the data type of the selected input. The data type of the threshhold input must be boolean or double.

Parameters and Dialog Box

Threshold
The value of the control (the second input) at which the switch flips to its other state. You can specify this parameter as either a scalar or a vector equal in width to the input vectors.

Characteristics

Direct Feedthrough
Yes
Sample Time
Inherited from driving block
Scalar Expansion
Yes
Dimensionalized
Yes
Zero Crossing
Yes, to detect when the switch condition occurs


 Sum Terminator