matlab simulink should count how many times the value of a signal coming out of a simulink block changes. How can i realize this ???

9 ビュー (過去 30 日間)
Matlab Simulink should count how many times the value of a signal coming out of a simulink block changes. How can i realize this ???

採用された回答

A Jenkins
A Jenkins 2013 年 11 月 19 日
編集済み: A Jenkins 2013 年 11 月 19 日
You can use a "triggered subsystem" block and set the trigger to "either". Use your signal value as the trigger.
Then inside the triggered subsystem, use a sum block to add one to the previous value of your counter. This will execute every time the trigger is satisfied (so it will add one every time your signal value changes.)
  6 件のコメント
A Jenkins
A Jenkins 2013 年 11 月 19 日
First let's get your counter working.
As mentioned above, you must add one to the previous value of your counter, not to your signal.
(Also, I originally assumed your signal was boolean, but if this is not true, you can use an "enabled subsystem" and a detect change block instead of an "either" trigger).
Dennis
Dennis 2013 年 11 月 21 日
Thank you very much for the quick help

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConditionally Executed Subsystems and Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by