필터 지우기
필터 지우기

Inner matrix dimensions must agree.

조회 수: 2 (최근 30일)
m13
m13 2017년 6월 16일
댓글: John D'Errico 2017년 6월 17일
I am trying to solve the the equation below and keep getting the error that inner matrix dimensions don't agree. I've been looking at this for awhile and can't figure it out. K1 = 4x4 matrix, W = 4x4 matrix, TD = 4x3 matrix, tau = 3x1 matrix.
u2 = inv(K1)*Winv*TD*inv(TD'*Winv*TD)*tau;
  댓글 수: 3
m13
m13 2017년 6월 16일
I believe the problem might actually be earlier in my simulation. I am trying to use simulink and am completely new to it. Is there any way to look at each variable output after running the model?
David Goodmanson
David Goodmanson 2017년 6월 17일
I don't have simulink but no doubt someone who does will weigh in.

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

답변 (1개)

John D'Errico
John D'Errico 2017년 6월 16일
NEVER ASSUME ANYTHING. Never. When you have a problem like this, test those assumptions. Verify your facts. Because the fact is, MATLAB is not a liar. It tells the truth. If it tells you there is a matrix dimension mismatch, then that is because there is one.
whos K1 Winv TD tau
You have told us the shape of those variables. But not all of them. You told us that W is 4x4. Should we just assume that means the variable Winv is also 4x4?
If you are running this inside a function, verify the size of those matrices INSIDE the function. Why? Because people screw up. They change things without realizing they did. They overwrite variables with ones of a different size.
  댓글 수: 2
m13
m13 2017년 6월 16일
This issue is in an embedded matlab function in my simulink simulation. Is there a way to see the results variables it is computing as it runs? not sure how to do that to be able to debug.
John D'Errico
John D'Errico 2017년 6월 17일
I am in the same place as David, lacking simulink, I can't help you in that respect. The fact is your arrays do not conform in size for multiplication. So you need to track that down.

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

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by