Simulink matrix multiplication error when passing matrix to model

조회 수: 1 (최근 30일)
Dieter
Dieter 2024년 6월 4일
답변: Harald 2024년 6월 7일
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

답변 (1개)

Harald
Harald 2024년 6월 7일
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

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by