Azzera filtri
Azzera filtri

How to implement a counter in simulink to increment in defined number of step size

61 visualizzazioni (ultimi 30 giorni)
Dear All, I would like to implement a counter in simulink to be able to increment witha defined step size as variable. Currently the counter increment in a step of ONE. I would like to increment in step of 2 or 3 or so on based on input. Kindly guide me if any of you have implemented before or applied this logic with available blockset in simulink before. Please do the needful.

Risposte (1)

Robert U
Robert U il 15 Set 2017
Hi Shwetha Mangalore,
from what I understand there are several ways to achieve what you desire. I try to sketch you two ways:
  1. Take the block "Counter Free-Running" (probably you are using that one or the "Counter Limited) and scale the output by a following "Gain"-Block. For this approach, the sampling time of the counters and maximum values have to be defined as well as the scaling factor.
  2. Use the "Ramp"-Block with variable slope followed by a "Quantizer"-Block. The values "Quantization interval" can be adjusted as well as "Sample time" (if needed).
If you want to implement a variable slope of the counter depending on a time dependent input, you could build up a "simple" integrator.
Kind regards,
Robert

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by