-
Notifications
You must be signed in to change notification settings - Fork 1
/
viewMC.m
45 lines (39 loc) · 803 Bytes
/
viewMC.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function viewMC
% visualize the simulation
clear all
% load simulation data
load 'DATA/MC.mat' EV xt H N
whos
tt = [1:H]';
% visualize EV and Pr
figure
plot(tt/H, EV(1:H,:))
set(gca, 'XTick', .0:1.0/6.0:1.0);
datetick('x', 'HH:MM', 'keepticks');
% visualize xt
figure
hold on
for n = 1:N
xx = xt(n,1:H);
ii = [xx(:) ~= 0];
xx = xx(ii);
plot(tt(ii)/H, xx)
end
ylim([.5 3.5])
set(gca,'YTick',[1 2 3])
set(gca,'YTickLabel','Home|Work|Shopping')
pbaspect([2 1 1])
set(gca, 'XTick', .0:1.0/6.0:1.0);
datetick('x', 'HH:MM', 'keepticks');
xlabel('Time of the day')
export_fig('FIGURES/xt', '-pdf')
% caculate number of trips
num_trips = zeros(1,N);
for n = 1:N
xx = xt(n,1:H);
edges = diff([0;xx(:) == 0]);
num_trips(n) = sum(edges > 0);
end
% draw histgram of trip numbers
figure
hist(num_trips)