我需要以下简单矩阵操作的帮助。
我的输入是:
A =
9.8627 14.6475
65.7510 97.6500
-48.9131 -72.6431
65.7510 97.6500
B =
60.3806 39.3176 39.3176 22.1663 16.1483
0 0 0 0 0
123.8806 80.6665 80.6665 45.4778 33.1309
0 0 0 0 0
C =
279.2250 275.4000 183.6000 202.7250 84.1500
0 0 0 0 0
518.7707 511.6642 341.1095 376.6417 156.3418
0 0 0 0 0
然后我的matlab代码:
x_3 = size(A);
x_4 = size(B);
for m_1 = 1:x_3(1,2);
for n_1 = 1:x_4(1,2);
G = A(:,m_1)+ B(:,n_1)+C(:,n_1)
end
end
此代码的结果:
G =
349.4682
65.7510
593.7382
65.7510
G =
324.5802
65.7510
543.4176
65.7510
G =
232.7803
65.7510
372.8629
65.7510
G =
234.7540
65.7510
373.2064
65.7510
G =
110.1610
65.7510
140.5597
65.7510
G =
354.2531
97.6500
570.0081
97.6500
G =
329.3651
97.6500
519.6875
97.6500
G =
237.5651
97.6500
349.1328
97.6500
G =
239.5388
97.6500
349.4763
97.6500
G =
114.9458
97.6500
116.8296
97.6500
但我想要的输出只是一个矩阵 G,它包含上面显示的所有十个矩阵(作为列)。所以基本上它看起来像这样:
G =
349.4682 324.5802 BLAH...
65.7510 65.7510 BLAH...
593.7382 543.3176 BLAH...
65.7510 65.7510 BLAH...
请有人帮忙.... :(
我将不胜感激谢谢!