Simulink state space system with close loop

1 次查看(过去 30 天)
Hi everyone,
I need help to solve a problem.
I'm building a simulink system. I have an 'interpreted function' block where at the input there are values that I take from the work space of the main matlab, and in output it gives me a 1-D signal which is then input into the state space block. The state space block sends me two values, since my initial state is a 2x10 vector. Seeing with scope the graph gives me two signals that are row 1 and row 2 of my updated vector. How do I take one of the two lines of the state space block output, then insert it together with the initial inputs in the 'function interpreted' block and do a close loop?

回答(1 个)

Pranjal Kaura
Pranjal Kaura 2021-8-31
Hey,
It is my understanding that you want to extract a subset (a single row in your case) from the output of the state space block. You further want to pass this extracted vector into the 'function interpreted' block.
Variable Selector block can be used to extract a subset from the output of the state space block (say X). Since the shape of output 'X' is known, you can set the following parameters in the Variable selector block:
  • Number of input signals = 1
  • Selector Mode = 'Fixed'
  • Elements = [1] (2 if you want to extract the second row from the output X)
This extracted signal can then be concatenated to your inital inputs of the 'function interpreted' block using the Vector/Matrix concatenate block. You can further slice this input as per your requirement in the MATLAB function created for the 'function interpreted' block.

类别

Help CenterFile Exchange 中查找有关 Discontinuities 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by