How to show simulink output based on a previous output?

1 回表示 (過去 30 日間)
Munim Hussain
Munim Hussain 2020 年 12 月 16 日
回答済み: Shlok 2024 年 10 月 17 日
I want to make an output in simulink, depending on a previous output. If the previous output from a block is -ve, I wanna show an output naming 'Lagging' and if the output from the same block is +ve, I wanna show an output naming 'Leading'. How I can do that?

回答 (1 件)

Shlok
Shlok 2024 年 10 月 17 日
Hi Munim,
To generate the output based on the previous block's output, I suggest you using a “Switch” block. The “Switch” block allows you to route one of two inputs to the output based on a specified condition. To set it up, follow the following steps:
  • Supply the output of the previous block to the comparator input of the Switch block.
  • Set the “Leading” option for the first input and the “Lagging” option for the third input using a String Constant block.
  • Then, configure the comparator condition to >= 0.
This model will resemble the following image:
Alternatively, you can also use a MATLAB Functionblock. This allows you to write custom MATLAB code to compare the input and produce the desired string output.
To know more about the blocks mentioned above, refer to the following documentation links:
Hope this helps.

カテゴリ

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