Simulink simulation to confirm the change of a state after n number of cycles

2 views (last 30 days)
Greetings,
I am trying to build a Simulink simulation of an existing electronic element that is used to confirm the change to the boolean true of the input that is maintained after a specified number of cycles n. It is fairly easy to use a matlab script, but I am trying to integrate it to logical blocks that need to be optimized, since the number of blocks is dynamic and varies with the number of cycles and I need to use this block in hundreds of instances, I can't possibly build it using the traditional way of delaying the input n times and verifying that all the delayed states are true, is there any built in function that might help me?
Algorithm:
IF IN(k) = In(k-1) =… = In(k-Nb_cycles) = true THEN
Out(k) = true
ELSE
Out(k) = false
Thank you

Answers (1)

Fangjun Jiang
Fangjun Jiang on 10 Sep 2020
Use a "Detect Change" block and a "Counter" block. If no change is detected for "Nb_cycles" times, the output is ture, otherwise, it is false.

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!