Simulink matrix multiplication error when passing matrix to model

1 vue (au cours des 30 derniers jours)
Dieter
Dieter le 4 Juin 2024
Réponse apportée : Harald le 7 Juin 2024
Hi,
I am trying to create a simulink model that does a few matrix multiplications but I cant seem to get the inputs right.
This is the setup of the model. Wind and gravity are 3x1 vectors and DCM is a 3x3 matrix coming from the 6DOF fixed mass model.
The model itself looks like this:
Given the dimensions the expected multiplications should result in (3x3) * (3x1) = (3x1).
However, when running the simulation i get several dimension mismatch errors:
Error using uavsim (line 7)
Error due to multiple causes.
Caused by:
Error using uavsim (line 7)
Error in port widths or dimensions. 'Output Port 1' of 'storm_uav/Constant2' is a [3x1] matrix.
Error using uavsim (line 7)
Error in port widths or dimensions. 'Input Port 1' of 'storm_uav/Model5' is a one dimensional vector with 1 elements.
I don't know why this is happening as the dimensions are correct in my opinion. Is there a mistake in the way I pass the vectors and the matrix to the model?
Help is greatly appreciated.
Thanks

Réponses (1)

Harald
Harald le 7 Juin 2024
Hi,
if DCM is 3x3, I'd expect the signal dimensions to indicate that. However, it shows 9, so I'd think that this is really a vector with 9 elements.
If that is the case, you can use a Reshape block to convert it to a 3x3 matrix. Depending on the ordering of elements in the vector, you may need to use a Transpose block on top of it.
Best wishes,
Harald

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by