Anda di halaman 1dari 4

clc;

clearvars;

%01: Rumah - Pasteur


for index = 1:10000
a = 10*randi([90,110])/100;
aArr{index} = a;
end
aArr = cell2mat(aArr);

%disp('A =');
%disp(aArr);

%02: Rumah - Lembang


for index = 1:10000
b = 30*randi([80,120])/100;
bArr{index} = b;
end
bArr = cell2mat(bArr);
%disp('B =');
%disp(bArr);

%03: Pasteur - Parahyangan


for index = 1:10000
c = 10*randi([90,110])/100;
cArr{index} = c;
end
cArr = cell2mat(cArr);
%disp('C =');
%disp(cArr);

%04: Lembang - Subang


for index = 1:10000
d = 60*randi([80,120])/100;
dArr{index} = d;
end
dArr = cell2mat(dArr);
%disp('D =');
%disp(dArr);

%05: Parahyangan - Puncak


for index = 1:10000
e = 120*randi([90,110])/100;
eArr{index} = e;
end
eArr = cell2mat(eArr);
%disp('E =');
%disp(eArr);

%06: Parahyangan - Cikampek


for index = 1:10000
f = 90*randi([85,115])/100;
fArr{index} = f;
end
fArr = cell2mat(fArr);
%disp('F =');
%disp(fArr);

%07: Subang - Cikampek


for index = 1:10000
g = 60*randi([80,120])/100;
gArr{index} = g;
end
gArr = cell2mat(gArr);
%disp('G =');
%disp(gArr);

%08: Puncak - Bogor


for index = 1:10000
h = 60*randi([90,110])/100;
hArr{index} = h;
end
hArr = cell2mat(hArr);
%disp('H =');
%disp(hArr);

%09: Bogor - Jakarta


for index = 1:10000
i = 45*randi([85,115])/100;
iArr{index} = i;
end
iArr = cell2mat(iArr);
disp('I =');
disp(iArr);

%10: Cikampek - Jakarta


for index = 1:10000
j = 120*randi([85,115])/100;
jArr{index} = j;
end
jArr = cell2mat(jArr);
disp('J =');
disp(jArr);

%Rute 1: 01,03,05,08,09
for index = 1:10000
x1 = aArr(index) + cArr(index) + eArr(index) + hArr(index) + iArr(index);
x1Arr{index} = x1;
end
x1Arr = cell2mat(x1Arr);
disp('X1 =');
disp(x1Arr);

%Rute 2: 01, 03, 06, 10


for index = 1:10000
x2 = aArr(index) + cArr(index) + fArr(index) + jArr(index);
x2Arr{index} = x2;
end
x2Arr = cell2mat(x2Arr);
disp('X2 =');
disp(x2Arr);
%Rute 3: 02, 04, 07, 10
for index = 1:10000
x3 = bArr(index) + dArr(index) + gArr(index) + jArr(index);
x3Arr{index} = x3;
end
x3Arr = cell2mat(x3Arr);

disp('X3 =');
disp(x3Arr);

%Rataan ketiga rute


disp('Rataan Rute 1 = ');
disp(mean(x1Arr));
disp('Rataan Rute 2 = ');
disp(mean(x2Arr));
disp('Rataan Rute 3 = ');
disp(mean(x3Arr));

%Min & Max ketiga rute


disp('Max & Min Rute 1 = ');
disp(max(x1Arr));
disp(min(x1Arr));

disp('Max & Min Rute 2 = ');


disp(max(x2Arr));
disp(min(x2Arr));

disp('Max & Min Rute 3 = ');


disp(max(x3Arr));
disp(min(x3Arr));

subplot(1,3,1);
plot(x1Arr);
title('Rute 1');
xlabel('Sampel ke-');
ylabel('Waktu tempuh');
subplot(1,3,2);
plot(x2Arr);
title('Rute 2');
xlabel('Sampel ke-');
ylabel('Waktu tempuh');
subplot(1,3,3);
plot(x3Arr);
title('Rute 3');
xlabel('Sampel ke-');
ylabel('Waktu tempuh');
Grafik:

Anda mungkin juga menyukai