How to show simulink output based on a previous output?

4 visualizzazioni (ultimi 30 giorni)
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?

Risposte (1)

Shlok
Shlok il 17 Ott 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.

Categorie

Scopri di più su Modeling in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by