Stateflow如​何实现类似下降沿的转​换?并且能够复位循环​触发。

Stateflow如何实现类似下降沿的转换?并且实现复位?
我想在参数A减小为0的时候由状态1转换到状态2,然后在条件B满足时转换回状态1,此时参数A仍然小于0,但会逐渐增大超过0,然后减小, 再一次通过0,此时发生第二次切换,如此循环
该怎么处理比较好?

 採用された回答

morayi
morayi 2022 年 11 月 30 日

0 投票

A如果是double型,0无法准确表示。
判断条件可以更改为
A的绝对值小于一定的tolerance就可以认为是0。
当前时刻 A的绝对值大于tolerance && 上一时刻 A的绝对值小于tolerance
A如果是整形,就没问题。
当前时刻 A的绝对值~= 0 && 上一时刻A == 0

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStateflow についてさらに検索

タグ

質問済み:

2022 年 11 月 30 日

回答済み:

2022 年 11 月 30 日

Community Treasure Hunt

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

Start Hunting!