Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Hi, can you help me!!! I 've got a problem when i went to calculate this matrix:

1 回表示 (過去 30 日間)
yousra yahia
yousra yahia 2018 年 5 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
A= [Aa 0;-Af*Ca Af]
With
Aa=[-0.01320 0 0 9.8100 0 0 0 0;-0.08560 -0.9903 -241.7000 0 21.7500 0.9504 18.0800 -0.00073;-0.00017 0.0159 -0.9883 0 -0.4850 -0.0323 -3.3200 -0.10450;0 0 1 0 0 0 0 0;0 0 0 0 0 1 0 0;0.08420 0.8897 -3.0300 0 -164.6000 -4.2050 -28.0500 -0.59690;0 0 0 0 0 0 0 1;-0.02920 -0.1723 -5.0970 0 -2.8540 -0.4456 -430.5000 -2.15500];
Af=diag([-10 -10]);
  5 件のコメント
yousra yahia
yousra yahia 2018 年 5 月 1 日
編集済み: Walter Roberson 2018 年 5 月 1 日
Af=diag([-10 -10]);
Ca=[-0.05540 -0.6511 5.1620 0 112.2000 3.0360 152.9000 1.1390;-0.00804 -0.0850 0.2943 0 -2.9510 -0.0590 -26.5500 -0.1560];
Aa=[-0.01320 0 0 9.8100 0 0 0 0;-0.08560 -0.9903 -241.7000 0 21.7500 0.9504 18.0800 -0.00073;-0.00017 0.0159 -0.9883 0 -0.4850 -0.0323 -3.3200 -0.10450;0 0 1 0 0 0 0 0;0 0 0 0 0 1 0 0;0.08420 0.8897 -3.0300 0 -164.6000 -4.2050 -28.0500 -0.59690;0 0 0 0 0 0 0 1;-0.02920 -0.1723 -5.0970 0 -2.8540 -0.4456 -430.5000 -2.15500];
A=[Aa 0;-Af.*Ca Af];
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in Matrice (line 4)
A=[Aa 0;-Af.*Ca Af];

回答 (1 件)

James Tursa
James Tursa 2018 年 5 月 1 日
編集済み: James Tursa 2018 年 5 月 1 日
You need to tell MATLAB how many 0's are being concatenated in the upper right corner. E.g.,
A = [Aa zeros(size(Aa,1),size(Af,2));-Af*Ca Af];
  3 件のコメント
the cyclist
the cyclist 2018 年 5 月 1 日
編集済み: the cyclist 2018 年 5 月 1 日
This code, which is exactly what you posted (with a bit of reformatting), and James' correction, worked for me.
Af=diag([-10 -10]);
Ca=[-0.05540 -0.6511 5.1620 0 112.2000 3.0360 152.9000 1.1390;
-0.00804 -0.0850 0.2943 0 -2.9510 -0.0590 -26.5500 -0.1560];
Aa=[-0.01320 0 0 9.8100 0 0 0 0;
-0.08560 -0.9903 -241.7000 0 21.7500 0.9504 18.0800 -0.00073;
-0.00017 0.0159 -0.9883 0 -0.4850 -0.0323 -3.3200 -0.10450;
0 0 1 0 0 0 0 0;
0 0 0 0 0 1 0 0;
0.08420 0.8897 -3.0300 0 -164.6000 -4.2050 -28.0500 -0.59690;
0 0 0 0 0 0 0 1;
-0.02920 -0.1723 -5.0970 0 -2.8540 -0.4456 -430.5000 -2.15500];
A = [Aa zeros(size(Aa,1),size(Af,2));-Af*Ca Af];
Note that John changed
-Af.*Ca
to
-Af*Ca
to make it a matrix multiplication. Your code, which would do element-by-element multiplication would fail because you cannot do that between a 2x2 and a 2x8. Whether that type of multiplication is what you need is up to you to determine.
yousra yahia
yousra yahia 2018 年 5 月 2 日
Thank you, i got the result but i had an other problem :
Af=diag([-10 -10]) Da=[4.3970 33.4300; -0.4182 -1.1780] Ba=[0 0;6.8060 9.2750; -1.7700 -0.7986; 0 0;0 0; 6.1130 -42.0300; 0 0; -20.2700 -13.2900] B=[Ba -Af*Da]
>> Af=diag([-10 -10]) Da=[4.3970 33.4300; -0.4182 -1.1780] Ba=[0 0;6.8060 9.2750; -1.7700 -0.7986; 0 0;0 0; 6.1130 -42.0300; 0 0; -20.2700 -13.2900] B=[Ba -Af*Da]
Af =
-10 0
0 -10
Da =
4.3970 33.4300
-0.4182 -1.1780
Ba =
0 0
6.8060 9.2750
-1.7700 -0.7986
0 0
0 0
6.1130 -42.0300
0 0
-20.2700 -13.2900
Error using horzcat Dimensions of matrices being concatenated are not consistent.

この質問は閉じられています。

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by