Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matrix direct sum

Status
Not open for further replies.

raghu81

Technical User
Apr 9, 2008
28
DE
Hello everyone,

Thanx for the previous answers. Spl thanx to xwb.

I need help in coding matrix direct sum. I have 'n' matrices of varying size. I want to read them as a single matrix as the direct sum of all the 'n' matrices.

I have 'n' matrices P(n) and the sizes of the matrices Size(n). I want to do a direct sum to get a matrix

P(1) 0 0 ...
D = 0 P(2) 0 ...
0 0 P(3) ...
. . .
. . .

Thanx in advance,
raghu.
 
That is not a "sum" of matrices.

You need to define one large array that will accommodate
all the elements that you want.

Then for each little matrix, you write:

x(1:m,1:n) = a

where a is dimensioned as a(m,n)
for the first little array,

x(m+1:m+q, n+1:n+r) = b

(where b is dimensioned as b(q, r)

for the second, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top