MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 想问一下三个矩阵合为一个矩阵的程序实现方法 (https://www.labfans.com/bbs/showthread.php?t=12379)

半條龍 2010-12-11 14:28

想问一下三个矩阵合为一个矩阵的程序实现方法
 
不好意思 小弟在矩阵上又遇上了一个有趣的问题
想问板上各位英雄们帮实现程序 在此先感激各位并谢谢

想问一下三个矩阵合为一个矩阵的方法:
简单说小弟三有个矩阵A、B、C,希望求D
以下是数据
clear all
A =
[[COLOR="Blue"]2 6 4 8; % 1
5 7 8 2; % 2
1 5 6 4[/COLOR]]; [COLOR="Blue"]% 3[/COLOR]
B =
[[COLOR="Red"]4 8 7 4; % 1
7 8 2 6; % 2
3 2 5 5[/COLOR]]; [COLOR="Red"] % 3[/COLOR]
C =
[[COLOR="YellowGreen"]8 4 1 1; % 1
6 9 5 4; % 2
7 7 8 9[/COLOR]]; [COLOR="yellowgreen"]% 3[/COLOR]
A、B、C都是3*4大矩阵,所以合并的D是(3*3)*(3*4)=9*12大的矩阵

D =
[ [COLOR="Blue"]A[/COLOR] 0 0
0 [COLOR="Red"]B[/COLOR] 0
0 0 [COLOR="YellowGreen"]C[/COLOR]
所以D最后会得到的答案是
D=
[[COLOR="Blue"]2 0 0 6 0 0 4 0 0 8 0 0; % 1[/COLOR]
[COLOR="Red"]0 5 0 0 8 0 0 7 0 0 4 0; % 1[/COLOR]
[COLOR="YellowGreen"] 0 0 8 0 0 4 0 0 1 0 0 1; % 1[/COLOR]
[COLOR="blue"]5 0 0 7 0 0 8 0 0 2 0 0; % 2[/COLOR]
[COLOR="red"]0 7 0 0 8 0 0 2 0 0 6 0; % 2[/COLOR]
[COLOR="yellowgreen"]0 0 6 0 0 9 0 0 5 0 0 4; % 2[/COLOR]
[COLOR="blue"]1 0 0 5 0 0 6 0 0 4 0 0; % 3[/COLOR]
[COLOR="red"]0 3 0 0 2 0 0 5 0 0 5 0; % 3[/COLOR]
[COLOR="yellowgreen"]0 0 7 0 0 7 0 0 8 0 0 9]; % 3[/COLOR]


所有时间均为北京时间。现在的时间是 13:58

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.