Recreating the debouncer example in Simulink

23 ビュー (過去 30 日間)
eledamiri
eledamiri 2014 年 11 月 18 日
コメント済み: Gulfer Ozcetin 2021 年 5 月 2 日
I'm trying to implement the debouncer example in simulink without using stateflow and using simple simulink blocks? Any idea how can I detect if the input signal stays positive or negative for 0.1 seconds?
Any help would be appreciated. Thanks

採用された回答

C.J. Harris
C.J. Harris 2014 年 11 月 18 日
編集済み: C.J. Harris 2014 年 11 月 18 日
You can use integrators as counters. Check for your desired state (TRUE or FALSE), then convert this TRUE signal into a double/single value, and feed it into an integrator. Then all you have to do is check when your output reaches your desired value (0.1 seconds).
Make sure you set the correct sample time (if using a discrete system), and also initialise/reset your integrator to zero.
If you need it to be constantly true for a time then just reset your integrator when you have an undesirable input.
For example, the output for this system will be true if the input has been FALSE for at least 0.1 seconds:
  1 件のコメント
Gulfer Ozcetin
Gulfer Ozcetin 2021 年 5 月 2 日
Hello, thanks for your help! May you also give some clues about detecting signal fluctuation around 0 so I can implement fault state? For example, for 0.3 seconds; if signal fluctuates around 0; I need to rise an error flag.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by