Asked by Kirti
on 7 Dec 2012

Dear all, i have X= x1+ x2+ x3 all are 5 by 6 size matrix. now this X is split into two disjoint group . The matrices within each group are added. how to do this in matlab?please explain with some example.

*No products are associated with this question.*

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 3 Comments

## Lalit Patil (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55987#comment_115866

%Example :

x1 = [1 2 3;4 5 6];

x2 = [1 2 3;4 5 6];

x3 = [1 2 3;4 5 6];

[m n] = size(x1);

for i = 1:m

for j = 1:n

x(i,j) = x1(i,j) + x2(i,j) + x3(i,j) ;

end

end

## Vishal Rane (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55987#comment_115873

@Lalit : For identical size matrices simply use

## Lalit Patil (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/55987#comment_115875

Oh yes, i tried it.. Thanks..