Invalid dimensions between blocks in Simulink

조회 수: 28 (최근 30일)
Andreas Burheim Volden
Andreas Burheim Volden 2015년 2월 16일
댓글: Andreas Burheim Volden 2015년 2월 18일
Hi!
I'm struggling with the error message of invalid dimensions between two blocks - see figure from simulink.
The gain block uses matrix Bd(set to matrix multiplication(K*u)) which is a 5x2 matrix. The random number has nothing fancy with it, in this case just noise. I've tried using the Signal Specification block as seen above to make the signal appear as a 1x5 vector, but this fails in the same manner.
The errors say "output port widths or dimensions of the Signal specification is a [1x5] matrix"
and "Invalid dimensions specified for input port of gain. Gain has dimensions [5x2] while input is set to dimensions [1x5]. These dimensions is not suitable for matrix product with the input signal"
Any helpers who could help here? Much appreciated!

채택된 답변

A Jenkins
A Jenkins 2015년 2월 16일
Do you want a 1x5 array of different random numbers, or the same 5 times?
Either way, if you have u=[1x5] and Bd=[5x2], then you need u*Bd, not Bd*u.
  댓글 수: 3
A Jenkins
A Jenkins 2015년 2월 17일
You should be able to build any size u matrix you want using "Vector Concatenate".
However, the inner dimensions of your matrix product must agree. So if your system has p inputs, q outputs, and n state variables, then x=nx1, A=nxn, B=nxp, and u=px1.
What is the number of states, n, in your system? If you want Bd*noise and have r noise inputs, then Bd=nxr and noise=rx1.
Andreas Burheim Volden
Andreas Burheim Volden 2015년 2월 18일
Thanks again!
For this system, I have 5 states and two inputs and two outputs, thus a 2x2 system.
Bd is a 5x2 matrix, and noise should, as you point out, be a 2x1 matrix. This would make all the summing terms, A*x + B*u + Bd*noise, 5x1 vectors which coincide with the state vector derivative xdot. And thus by integrating xdot I get back to the state vector x which also is [5x1]. Cheers!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by