Block Inputs: Two scalar inputs labeled “l” and “r.”
The greater than (>) block is useful in evaluating the Boolean > inequality. The output of the > block is 1 if and only if input “l” > input “r;” otherwise the output is 0.
If you right click the > block, the Boolean block menu appears allowing you to assign a different function to the block.
1. Simple if-then-else construct
Consider a variable y such that:
If t > 2 then y = 7.2; else y = 0
Assume that t is simulation time. This system can be realized as shown below.
By multiplying a constant value of 7.2 with the output of the > block, y is guaranteed to assume a value of zero until the inequality is true. When the inequality is true, y assumes a value equal to the output of the * block.
2. Modified if-then-else construct
Using the above equation, it can also be realized as:
The key difference in implementation is the use of a merge block rather than a * block. The merge block explicitly depicts the if-then-else structure, whereas the * block is a shortcut and can lead to confusion.