Documentation Center

  • Trial Software
  • Product Updates

If-Then-Else Blocks

This example shows what happens when a sine wave is fed into an If block. After running the simulation, the scope shows three plots. This example is designed to compare the If block with enabled subsystems.

The first of these plots shows the original sine wave and the absolute value of the original sine wave offset by two. The absolute value of the sine wave is only shown when the subsystem is executed. This occurs between 0 and 2.5 seconds and 5 and 7.5 seconds. When the subsystem is not executed then the output of the subsystem is reset to 0. The value of 0 is determined by the initial condition of the outport. You can see when the subsystem is executed by looking at the second plot. A value of 1 indicates that it is executed.

The second plot shows the original value of the input signal. If the signal is towards the top of the plot then the if subsystem related to the first plot is executed. If the signal is towards the bottom of the plot then the else subsystem related to the third plot is executed.

The third plot shows the original sine wave and the saturation limited sine wave offset by two. The saturated value of the sine wave is only shown when the subsystem is executed. This occurs between 2.5 and 5 seconds and 7.5 and 10 seconds.

Was this topic helpful?