Main Content

If-Then-Else Blocks

This example shows the effect of feeding a sine wave into If Action Subsystem blocks. It is designed to illustrate the similarity between the If Action Subsystem block and the Enabled Subsystem block.

A pulse generator is connected to an If block, which compares the input to zero. If the input is positive, as specified by the if condition, then the If Action Subsystem Abs is activated, which outputs the absolute value of the sine wave input signal. If the input to the If block is not positive, as specified by the else condition, then the If Action Subsystem Saturation between -0.75 and 0.75 is activated, which outputs a clipped version of the sine wave signal using a Saturation block.

The outputs of the two subsystems are never active at the same time and are merged into one signal with a Merge block. The output signal is then biased by +2.

The scope shows the sine wave input, the triggering pulse input, and the merged and biased output. When the pulse is on, the output is the absolute value of the sine wave. When the pulse is off, the output is the clipped version of the sine wave. In each case, the output is biased by +2.

See Also

|

Related Topics