Professional Documents
Culture Documents
NIM : 1720201016
M. Kuliah : Analisa Numerik
Latihan Bab 3
Jawaban
1. V1=[10, 20, 30, 40], V2=[-5;-15;-40], V3=[1 3 5 0;3 1 3
5;5 3 1 3;0 5 3 1],
V1 =
10 20 30 40
V2 =
-5
-15
-40
V3 =
1 3 5 0
3 1 3 5
5 3 1 3
0 5 3 1
2. A=[4 8;2 4], B=[1 1;1 -1], C=[A B], W=[B B;B -B]
A = B= C=
4 8 1 1 4 8 1 1
2 4 1 -1 2 4 1 -1
W =
1 1 1 1
1 -1 1 -1
1 1 -1 -1
1 -1 -1 1
3. size(V1), size(V2), size(V3), size(A), size(B), size(C),
size(W), prod(size(V1)), prod(size(V2)), prod(size(V3)),
prod(size(A)), prod(size(B)), prod(size(C)),
prod(size(W))
size(V1) size(V2) size(V3)
ans = ans = ans =
1 4 3 1 4 4
mean = variasi = mu =
1 0.2000 1
bill_acak_gaussian =
Columns 1 through 15
1.3758 0.6029 1.0448 0.7565 1.1357
0.7315 1.2191 1.3307 1.7656 0.9132 0.0437
0.6245 1.6058 0.5205 1.4298
Columns 16 through 30
1.0555 1.6425 0.1231 0.9116 0.4598
2.3005 1.3690 1.6167 0.5268 0.7904 0.8781
1.4912 0.8757 1.3137 0.0824
Columns 31 through 45
0.8418 0.6317 0.2947 1.2272 1.1261
1.0150 0.4036 1.5042 1.1566 0.8663 1.0102
0.8828 0.2173 0.8723 0.6282
Columns 46 through 60
0.5621 0.4828 0.7614 0.1044 1.4312
1.2326 0.9910 0.9844 0.6431 1.4556 0.9404
0.6805 1.6044 0.8995 0.7366
Columns 61 through 75
0.8686 0.6208 0.4991 2.1297 1.7404
1.1375 0.4378 0.6130 0.9211 1.3539 0.4043
-0.0419 0.3519 1.1492 1.1750
Columns 76 through 90
1.2020 0.9417 1.0821 0.7871 1.3855
0.3910 1.2035 0.6204 0.8502 1.2472 1.4647
0.5002 1.5638 1.2952 0.9696
Kolom_ketiga =
10
4
3
8
5
Baris_ketiga_hingga_kelima_kolom_kedua_hingga_keempat =
0 3 6
16 8 4
-5 5 -5
x =
-10 -9 -8 -7 -6 -5 -4 -3 -2
-1 0 1 2 3 4 5 6 7 8
9 10
y =
Columns 1 through 15
7.5000 7.0000 6.5000 6.0000 5.5000
5.0000 4.5000 4.0000 3.5000 3.0000 2.5000
2.0000 1.5000 1.0000 0.5000
Column 16
0
z =
Columns 1 through 26
1 4 7 10 13 16 19 22 25
28 31 34 37 40 43 46 49 52 55
58 61 64 67 70 73 76
Columns 27 through 34
79 82 85 88 91 94 97 100
x =
-10 -9 -8 -7 -6 -5 -4 -3 -2
-1 0 1 2 3 4 5 6 7 8
9 10
y =
Columns 1 through 15
7.5000 7.0000 6.5000 6.0000 5.5000
5.0000 4.5000 4.0000 3.5000 3.0000 2.5000
2.0000 1.5000 1.0000 0.5000
Column 16
0
z =
Columns 1 through 26
1 4 7 10 13 16 19 22 25
28 31 34 37 40 43 46 49 52 55
58 61 64 67 70 73 76
Columns 27 through 34
79 82 85 88 91 94 97 100
ans =
1.0e+06 *
M =
1 5 10 15 20
1 2 4 8 16
-3 0 3 6 9
32 16 8 4 2
5 -5 5 -5 5
N =
1 5 10 15
1 2 4 8
-3 0 3 6
32 16 8 4
5 -5 5 -5
N =
1 5 10 15
1 2 4 8
-3 0 3 6
32 16 8 4
5 -5 5 -5
fliplr(N flipud(N)
ans = ans =
15 10 5 1 5 -5 5 -5
8 4 2 1 32 16 8 4
6 3 0 -3 -3 0 3 6
4 8 16 32 1 2 4 8
-5 5 -5 5 1 5 10 15
reshape(N,10,2) reshape(N,4,5)
ans = ans =
1 10 1 5 16 3 8
1 4 1 5 -5 8 6
-3 3 -3 2 10 5 4
32 8 32 0 4 15 -5
5 5
5 15
2 8
0 6
16 4
-5 -5
Latihan Bab 4
Jawaban
1. M=[10 20;5 8], N=[-1 1;1 -1], M+N, M-N, N+9, M*N, N*M
M= N=
10 20 -1 1
5 8 1 -1
M*N N*M
ans = ans =
10 -10 -5 -12
3 -3 5 12
2. a=[0 5 5], b=[1 1 1], dot(a,b), cross(a,b), cross(b,a)
a= b=
0 5 5 1 1 1
S=
1.0000
-1.0000
2.0000
4. x=-5:inkremen:5;clearinkremen=0.05;x=-5:inkremen:5;y=sqrt(25-
x.^2);panjang=length(x);titik_tengah=round(panjang/2);x_baru=x(titik_tengah-
1:titik_tengah+1),
5. inkremen=0.1;x=-
5:inkremen:5;x1=sort(x),t=x1.*pi/180;y1=sinh(t);y2=cosh(t);y3=tanh(t);tabel=[x;y1;y
2;y3]';judul='x, sinh, cosh, tanh';
x1 =
Columns 1 through 15
-5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000
-4.1000 -4.0000 -3.9000 -3.8000 -3.7000 -3.6000
Columns 16 through 30
-3.5000 -3.4000 -3.3000 -3.2000 -3.1000 -3.0000 -2.9000 -2.8000 -2.7000
-2.6000 -2.5000 -2.4000 -2.3000 -2.2000 -2.1000
Columns 31 through 45
-2.0000 -1.9000 -1.8000 -1.7000 -1.6000 -1.5000 -1.4000 -1.3000 -1.2000
-1.1000 -1.0000 -0.9000 -0.8000 -0.7000 -0.6000
Columns 46 through 60
-0.5000 -0.4000 -0.3000 -0.2000 -0.1000 0 0.1000 0.2000 0.3000
0.4000 0.5000 0.6000 0.7000 0.8000 0.9000
Columns 61 through 75
1.0000 1.1000 1.2000 1.3000 1.4000 1.5000 1.6000 1.7000 1.8000
1.9000 2.0000 2.1000 2.2000 2.3000 2.4000
Columns 76 through 90
2.5000 2.6000 2.7000 2.8000 2.9000 3.0000 3.1000 3.2000 3.3000
3.4000 3.5000 3.6000 3.7000 3.8000 3.9000