フィルターのクリア

Why does this matrix multiplication work?

1 回表示 (過去 30 日間)
Philipp
Philipp 2013 年 6 月 10 日
Hi,
I had a look at the Simmechanics Demo mech_bouncing_ball.mdl because I want to find out how to model ground.
In the subsystem that calculates the force that acts on the ball when hitting the floor is a matrix multiplication.
It is calculated with a Gain-Block. The input is a 1x3 Matrix, the Gain Parameter is [0 0 0;0 0 0;0 0 -ball.pengain] and the output is again a 1x3 matrix. The Setting of the calculation is "Matrix(K*u)". The Help says: "The input and gain are matrix multiplied with the input as the second operand."
I dont't understand how this works. How is it possible that a 3x3 matrix is multiplied with a 1x3 matrix? When I try that in the comand window it says that "Inner matrix dimensions must agree." Why does it work with the Gain Block?
Would be great if someone could help me. I really don't understand that. Thank you very much!

回答 (1 件)

David Sanchez
David Sanchez 2013 年 6 月 11 日
What's wrong with it?
a=rand(1,3);
b=rand(3,3);
c=a*b;
  3 件のコメント
Iain
Iain 2013 年 6 月 11 日
Its using the vector, as a column. eg
A = [0 1 0; 1 0 0; 0 0 1];
B = [2 3 4];
C = A*B';
C = [3; 2; 4]
Philipp
Philipp 2013 年 6 月 11 日
Exactly Andrew, thats what I meant. @lain: But the output of the gain block is not a 3x1 Matrix but again 1x3. I guess it transforms it back after the multiplication. But why does that happen? And in which cases does it do that?
I don't find that very logical..

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by