How to show simulink output based on a previous output?

4 Ansichten (letzte 30 Tage)
Munim Hussain
Munim Hussain am 16 Dez. 2020
Beantwortet: Shlok am 17 Okt. 2024
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?

Antworten (1)

Shlok
Shlok am 17 Okt. 2024
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.

Kategorien

Mehr zu Modeling finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by