Create a matrix in Simulink

The diagram below is the block diagram that I have created in order to generate the matrix B.
I want the matrix B to be in the size of [9x6] but what I have done in the simulink give me a warning message as: 'Magnetic/B' generated a [9x6] matrix data. It automatically reshaped the data to a one dimensional vector with 54 elements.
My question is: How to make the matrix B stay in the size of [9x6]?
I have attached the simulink model in the file as well. I am really appreciate your help.

 Respuesta aceptada

Ameer Hamza
Ameer Hamza el 28 de Abr. de 2020
Editada: Ameer Hamza el 30 de Abr. de 2020

0 votos

Because in the function Interpreted MATLAB function block B, you have set the output dimension to 54. Change it to [9 6].

6 comentarios

Linee Teh
Linee Teh el 30 de Abr. de 2020
Thank you! Why I didn't think of that easy way! Really appreciate your help
Ameer Hamza
Ameer Hamza el 30 de Abr. de 2020
I am glad to be of help.
Linee Teh
Linee Teh el 2 de Mayo de 2020
Hey Ameer, I have another question.
If my control law is u = -kx and substitute the control law into the state space equation x_dot = Ax + Bu, it give me x_dot = (A-BK)x and the first figure below shows the configuration.
Then, I added the disturbance into the system but it shouldn't look like this as shown in the figure below. Input matrix B and Gain K should be multiply with each other and the disturbance is added on. How can I modified the simulink block to get what I want?
Thank you..
Ameer Hamza
Ameer Hamza el 2 de Mayo de 2020
"I added the disturbance into the system" is an ambiguous term. Where are you adding the disturbance? In the state-vector? In the control input? In the output vector? All of these are possible. Can you show the equation of your system with the disturbance added to it?
Linee Teh
Linee Teh el 2 de Mayo de 2020
I am sorry that I forget to included the equation. x_dot=(A-BK)x + d where d is the disturbance.
Ameer Hamza
Ameer Hamza el 2 de Mayo de 2020
do it like this

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Schedule Model Components en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de Abr. de 2020

Comentada:

el 2 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by