Gain dimension failure ending in error

2 ビュー (過去 30 日間)
Lennart
Lennart 2024 年 6 月 12 日
編集済み: Lennart 2024 年 6 月 12 日
At first, I built the following control circle:
Gain window
As you can see x is a (4,1)-vector and in the picture below you can see G is a (1,4)-Matrix.
Multiplying a K.*u means G.*x means in dimensions: (1,4)*(4,1)=(1,1). But (however) a (4,4)-matrix is the solution, which leads to an error, cos I cant add 4,4 and a scalar. So why is (4,4) the solution or what did I miss in the gain window? (I set element wise multiplication K.*u)
  1 件のコメント
Lennart
Lennart 2024 年 6 月 12 日
編集済み: Lennart 2024 年 6 月 12 日
Sorry I got it myself... I have to set Matrix(K*u) in the G window, so (1,4)*(4,1)=(1,1) and it does what it should do.

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

採用された回答

Aquatris
Aquatris 2024 年 6 月 12 日
編集済み: Aquatris 2024 年 6 月 12 日
G gain is set for element wise multiplication instead of matrix multiplication, hence (1,4).*(4,1) = (4,4).
x = ones(4,1);
G = ones(1,4);
size(G.*x) % element wise multiplication
ans = 1x2
4 4
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
size(G*x) % matrix multiplication
ans = 1x2
1 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Set the "Multiplication"drop down menu for the G gain to 'matrix multiplication'.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by