summaryrefslogtreecommitdiff
path: root/1034/CH1/EX1.11/Example11.sce
blob: 6a8aee12d62f0cd532cb5cb58c30afc4743eb08a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
clear;
clc;
printf("\n Example 1.11");
// Matrix addition.
a=[1 2 3;4 5 6];
b=[7 8 9;10 11 12];
x=matrix(a,3,2);........//no. of rows=3,no. of col. =2.
y=matrix(b,3,2);........//no, of rows=3,no. of col.=2.
printf("matrix x=");
disp(x);
printf("matrix y=");
disp(y);
[p,q]=size(x);
i=1;
j=1;
for i=1:p
    for j=1:q
        z(i,j)=x(i,j)+y(i,j);..........//summing two matrices
    end
end
printf("\n Resultant matrix after addition =");
disp(z);.............//displayin sum of two matrices.