Tugas 3
Tugas 3
Tugas 3
Nim : 60400118012
Kelas : Fisika C
TUGAS 3
Halaman 43-44
Tugas (Latihan Pemrograman_4)
1. >> g=[4 2 10;1 8 2;2 1 50];
>> h=[20 50 100;20 38 20;10 23 50];
a. >> g+h
ans =
24 52 110
21 46 22
12 24 100
b. >> g-h
ans =
-16 -48 -90
-19 -30 -18
-8 -22 0
c. >> 2*g+3*h
ans =
68 154 320
62 130 64
34 71 250
d. >> 2*(g+h)
ans =
48 104 220
42 92 44
24 48 200
e. >> g^2+h^2
ans =
2438 5234 8544
1376 2972 3886
1269 2586 6482
f. >> 3*g*(2*g+2*h)
ans =
1548 3240 8904
1296 2808 2916
4014 8100 31452
g. >> h/g
ans =
3.0815 5.3333 1.1704
4.3793 3.7333 -0.6252
1.6089 2.4000 0.5822
h. >> (2*h/2*g)/(h+g)
ans =
-32.3810 2.3810 88.0952
28.4974 -16.4974 -14.9577
-23.2751 5.2751 50.9021
i. >> h\2*g
ans =
1.0e+003 *
0.1650 0.2700 2.6500
0.0790 0.1820 0.6380
0.0815 0.1270 1.3230
2. Tentukan matriks berikut
a. >> zeros(5)
ans =
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
b. >> zeros(3)+pi
ans =
3.1416 3.1416 3.1416
3.1416 3.1416 3.1416
3.1416 3.1416 3.1416
c. >> eye(4)
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
d. >> ones(6)
ans =
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1