Simulink matrix multiplication error when passing matrix to model
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
Harald
am 7 Jun. 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu General Applications finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!