How to show simulink output based on a previous output?

4 visualizaciones (últimos 30 días)
Munim Hussain
Munim Hussain el 16 de Dic. de 2020
Respondida: Shlok el 17 de Oct. de 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?

Respuestas (1)

Shlok
Shlok el 17 de Oct. de 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.

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by