up or down counting based on input signal value

18 ビュー (過去 30 日間)
Anushka Shivalli
Anushka Shivalli 2022 年 7 月 8 日
編集済み: Jon 2022 年 7 月 11 日
I have to design a counter that counts up when the input signal value is 1 and the same counter should count down when the same input signal value is 3.
How do I do this in simulink??

回答 (1 件)

Jon
Jon 2022 年 7 月 8 日
This is one approach, the counter will increment at each sample time of the delay block (z^-1). You can set that parameter in the delay block dialog box
  3 件のコメント
Anushka Shivalli
Anushka Shivalli 2022 年 7 月 11 日
Request you to refer the attached image for the expected counter algorithm.
Jon
Jon 2022 年 7 月 11 日
編集済み: Jon 2022 年 7 月 11 日
In your problem description you said you wanted the counter to count down when the input is 3 and countup when the input is 1, this is what the above model does. You also did not say anything about the counter resetting, which seems to now be indicated in your hand sketch. Please try to provide a more complete specification for what, exactly, you want the model to do. Maybe a little context for the application would be helpful too.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSources についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by