Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

disjoint of matrix in Matlab?how to do ?

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.

3 Comments

Lalit Patil on 7 Dec 2012

%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 on 7 Dec 2012

@Lalit : For identical size matrices simply use

   x = x1+x2+x3
Lalit Patil on 7 Dec 2012

Oh yes, i tried it.. Thanks..

Kirti

Products

No products are associated with this question.

0 Answers

Contact us