Simulink block for determining output value based on a simple if statement regarding the input value?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kevin Bachovchin
am 6 Mär. 2016
Beantwortet: Vaibhav Awale
am 11 Mär. 2016
Hello,
Is there a Simulink block where I can determine the output value of a block based on a simple if statement regarding the input value to the block?
For example, I'm looking for a block that can do something similar to the following snippet of code
%u1 is the input to the block and u2 is the output if u1 > threshold u2 = 1 elseif u1 < -threshold u2 = -1 else u2 = 0; end I'm aware that I could do this by placing a MATLAB function in my Simulink block diagram, but I'm thinking for something this simple, there's probably some built-in Simulink block for doing this. The Simulink "if" block (<http://www.mathworks.com/help/simulink/slref/if.html>) does not seem to what I'm looking for. Is there some other block that can do what I want?
Thank you,
Kevin
0 Kommentare
Akzeptierte Antwort
Vaibhav Awale
am 11 Mär. 2016
Hello,
For multiple if-else conditions, you can simply nest the switch blocks in the same manner as you would do while writing code using if-else condition.
Hope this helps.
Regards,
Vaibhav
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!