Algebraic loops and counters in Simulink

Hi, I'm working with Simulink and I have 2 doubts:
1) I've modeled a counter. How would you do if I want that it counts 1 time per second for example? I mean, a counter sincronized with simulation time.
2) I'm working with a vector of continous signals that are changing its values. I want to implement a model that counts index from 1 to 7 (the vector's size). The counter must change its value only when the signal index value passes a limit number. For example: it starts maintainig 1 until v(1) passes the limit value, then maitains 2 until v(2) passes the limit... and when v(7) passes the value it will maintain number 1 again I've modeled it using the index vector block and a switch that turns 1 when signal overcomes the limit value and 0 when it's lower. That signal goes to a counter that resets its value to 1 when the vector value is higher than 7. If i include a 1/z block the indexing signal doesn't maintain the value and always changes to the lower one, I mean 000010101020202, instead of 00011112222

Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Asked:

on 6 Mar 2018

Community Treasure Hunt

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

Start Hunting!