not equal to (!=)

Block Inputs: Two scalar inputs.

The != block produces an output signal of 1 if and only if the two scalar input signals are not equal. On the connector tabs, “l” represents x1 and “r” represents x2.

If you right click the != block, the Boolean block menu appears allowing you to assign a different function to the block.

Examples

1. Comparing constants

Consider a variable y such that:

If t ≠ 0.5 then y = cos(t); else y = 0

where t is simulation time. This system can be realized as shown below.

Until the value of t reaches 0.5, the Boolean inequality t 0.5 evaluates to true, and y takes on a value of cos(t). At t = 0.5s, the Boolean inequality evaluates to false, and at the very next time step, returns to true, and remains true for the duration of the simulation. Consequently, at the moment t = 0.5s, y takes on the value of 0, and at every other point, y is equal to cos(t).