Search code examples
matlabsimulinkadcsar

Comparator model in simulink


I want to compare a number to another: if the comparison is true the current value must pass but if not it must stop. But I can't do this idea because the output of the compare block is boolean so if it is true, the output is 1 so the current value will not pass as same number. How can I do this idea? Thanks.enter image description here

The output is a 1 or 0 and that is not what I want


Solution

  • I think you want a switch block. This lets you pick between two different signals based on the value of some input - in your case, the result of the comparison. Something like this:

    Simulink model with switch block

    Here, the switch block passes the clock input through when the value is > 3 (you can pick the threshold and comparison type); otherwise, it passes through the value -2 from the Constant block.