Multiple if conditions are met simultaneously when IF Block in Simulink is used, why?
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Canberk Suat Gurel
el 21 de Mayo de 2018
Comentada: Ronnabel Sernicula
el 22 de Mayo de 2021
Hi all,
I am giving the following 5 conditions to the If Block inside an enabled subsystem. During the period of which the subsystem is enabled, the inputs to the If Block remain constant.
(u1 > u2)&(u1 > u3)&(u1 > u4)&(u1 > u5)
(u2 > u1)&(u2 > u3)&(u2 > u4)&(u2 > u5)
(u3 > u1)&(u3 > u2)&(u3 > u4)&(u3 > u5)
(u4 > u1)&(u4 > u2)&(u4 > u3)&(u4 > u5)
(u5 > u1)&(u5 > u2)&(u5 > u3)&(u5 > u4)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190715/image.jpeg)
There can only be one maximum and hence there should only be one condition that is met.
This scope shows the input to the If Block:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190716/image.jpeg)
u1, u2, u3, u4, and u5 are pink, blue, orange, green, and purple, respectively.
The output of the If Block shows that multiple conditions are met at the same time.
This Scope shows the nth condition that is met:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190717/image.jpeg)
However, there was supposed to be only one output (as there can only one maximum) and there rest of the signals were supposed to be zero.
This is my Enabled Subsystem:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/190718/image.jpeg)
Can someone explain this unexpected behavior? Thanks!
5 comentarios
Akshay Dhyani
el 5 de Abr. de 2021
Hi,
I am facing a similar issue where I have multiple condition on if block and it executes true if any one is fulfilled?
@Canberk Suat Gurel did you find the solution?
Respuestas (0)
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!