MATLAB Answers

How to get a threshold in Simulink that works in both directions and that make an action once per passing

1 ビュー (過去 30 日間)
Jørgen Svendby
Jørgen Svendby 2020 年 7 月 2 日
編集済み: Jonas 2020 年 7 月 6 日
Hi,
I have a simulink model where I have a signal that varies with a repeating sequence stair input. If this value passes a threshold value of 0.1 (both positive and negative direction) I want another number (let say 1000) to be withdrawn by 2 every time a passing takes place. So if there have been 5 passes (both up and down) in total, the number should end up being 990.
I thought this was going to be easy, but have still not been able to solve this.
Regards,
Jørgen

  0 件のコメント

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

採用された回答

Shubhankar Poundrik
Shubhankar Poundrik 2020 年 7 月 2 日
編集済み: Shubhankar Poundrik 2020 年 7 月 2 日
Hi Jorgen,
I understand that you want to decrement (or increment) a variable whenever a signal goes past a certain value.
A model similar to the one below may be helpful.
The value from which the output should start (1000 in given case) should be put as the initial value in the output delay block.
Regards,
Shubhankar.

その他の回答 (1 件)

Jonas
Jonas 2020 年 7 月 6 日
編集済み: Jonas 2020 年 7 月 6 日
There are multiple ways to do it. I would do it like this. It might inspire you. The variable State should be initialised to 1000.

  0 件のコメント

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by