check if a condition is true for a certain time (Simulink)
Show older comments
I have a simple problem but i can't find a solution.
I have the following model:

and I would like to get 1 as output of this model when the condition is respect for 0.8 consecutive seconds.
How can i do it?
1 Comment
Alberto Boñal Bravo
on 23 Nov 2021
Hi Marco, can you show how you solved your model?
Thank you!
Answers (1)
Fangjun Jiang
on 10 Mar 2020
1 vote
Connect this condition to an integrator. If the condition is true, the integration will increase. Compare it to 0.8, you will get the result. Specify the integrator to be reset by external source. Use the fall edge or low level of your condition to reset it.
4 Comments
Marco Bellusci
on 14 Mar 2020
Fangjun Jiang
on 14 Mar 2020
zero-order holder, set the sample time as 0.2s
ibrahim alzoubi
on 9 Dec 2020
Fengjun Jiang.. You are such a genius
Thank you 10 times per second for 50 years.
Fangjun Jiang
on 9 Dec 2020
:). Thank you!
Categories
Find more on Simulink in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!