Reset Clock Block - Matlab/Simulink
显示 更早的评论
Hello,
i have the simulation time as an input singal coming from a Clock Block. On condition (for example: when another signal x is greater or equal to a constant a) i want the time signal, that comes from the Clock Block, to be set to 0 and restart counting up again while the simulation time keeps going.
I do not know how to do this and whether it is purposeful to use the Clock Block. I hope someone can help and thank in advance!
Cheers
回答(1 个)
Gayan
2017-10-27
2 个投票
Im not sure it is possible directly.
But there is a workaround. Instead of using the output of the clock directly modify it.
Method 1; Use If block in held option and substract the value. I use a pulse generator as the reset trigger. See the image below.


>>
Method 2, you can use a memory block to subtract a constant from the clock out.
Then new_clock = Clock - value stored in mem block. When ever you want to reset the clock just set the mem block value to Clock.
类别
在 帮助中心 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!