フィルターのクリア

pass zeros to input using a flag

2 ビュー (過去 30 日間)
MP
MP 2023 年 8 月 25 日
回答済み: Brahmadev 2023 年 9 月 4 日
Hello, i am trying to use an enable/disable flag for an inport that takes in a bus. The bus is named MyBus and has two signals: Force and Torque, each one of size 3x1. If the enable flag is set to 1, then i want to pass in the values from the inport. If the flag is set to false, then i would like to pass 0s. The vectors from the bus each go into separate summers.
Is there a way to do this? Or is there a better way of doing this?

採用された回答

Brahmadev
Brahmadev 2023 年 9 月 4 日
Hi,
I understand that you would like to add an enable flag in your model. Your implementation as shown in the attached image seems like a perfectly reasonable way to approach it.
However, this can be done without using the switch block as well. You can simply multiply (using the "Product" block) the myBusEnabled flag with the MyBusZeroes bus. This will give an output of 0 when the flag is disabled and the Force and Torque Bus data when the flag is enabled.
Hope this helps!

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by