-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLap_Times.m
56 lines (52 loc) · 3.41 KB
/
Lap_Times.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
46
47
48
49
50
51
52
53
54
55
56
clc;
close all;
clear;
% Manual Lap Times
ManualRacers = {'P01' 'P01' 'P01' 'P01' 'P01' 'P01' 'P01' 'P01' 'P01' 'P01' ...
'P02' 'P02' 'P02' 'P02' 'P02' 'P02' 'P02' 'P02' 'P02' 'P02' ...
'P03' 'P03' 'P03' 'P03' 'P03' 'P03' 'P03' 'P03' 'P03' 'P03' ...
'P04' 'P04' 'P04' 'P04' 'P04' 'P04' 'P04' 'P04' 'P04' 'P04' ...
'P05' 'P05' 'P05' 'P05' 'P05' 'P05' 'P05' 'P05' 'P05' 'P05' ...
'P06' 'P06' 'P06' 'P06' 'P06' 'P06' 'P06' 'P06' 'P06' 'P06' ...
'P07' 'P07' 'P07' 'P07' 'P07' 'P07' 'P07' 'P07' 'P07' 'P07' ...
'P08' 'P08' 'P08' 'P08' 'P08' 'P08' 'P08' 'P08' 'P08' 'P08' ...
'P09' 'P09' 'P09' 'P09' 'P09' 'P09' 'P09' 'P09' 'P09' 'P09' ...
'P10' 'P10' 'P10' 'P10' 'P10' 'P10' 'P10' 'P10' 'P10' 'P10'}';
ManualTtimes = [65.12 65.94 65.73 65.28 65.02 65.14 65.29 64.98 64.43 64.78 ...
66.27 65.48 65.32 64.87 64.23 64.48 64.65 64.51 65.26 64.72 ...
65.43 65.26 64.55 64.62 64.34 64.17 64.53 64.42 64.68 64.72 ...
65.52 64.86 64.54 64.29 64.37 64.43 64.78 63.54 63.87 64.21 ...
64.92 65.27 64.86 64.52 63.84 64.62 64.21 64.59 64.43 64.37 ...
65.48 64.32 64.21 63.89 64.10 63.57 64.56 64.38 63.62 64.74 ...
64.33 64.72 64.29 64.81 64.64 64.92 64.78 64.37 64.56 64.44 ...
65.16 64.20 63.85 64.51 64.28 65.10 64.32 64.21 63.76 64.41 ...
65.12 64.25 64.31 64.89 64.36 65.98 64.76 64.26 64.37 63.98 ...
64.59 64.97 64.29 64.57 64.38 65.27 63.76 64.26 64.49 64.35]';
ManualTimeMean = mean(ManualTtimes)*ones(11)';
% Autonomous Lap Times
AutonomousRacer = {'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A'}';
AutonomousTimes = [64.48 62.58 62.87 63.04 63.35 62.98 63.17 62.82 63.44 62.75]';
AutonomousTimeMean = mean(AutonomousTimes)*ones(11)';
% Plot the data
figure('Name','LAP TIME RECORDS');
grid on;
hold on;
% Box chart for human racers
ManualRacers = categorical(ManualRacers); % Convert the labels to 'categorical' data type
boxchart(ManualRacers,ManualTtimes,'BoxFaceColor','blue','MarkerColor','blue'); % Plot the box chart for human racers
% Box chart for autonomous racer
AutonomousRacer = categorical(AutonomousRacer); % Convert the label to 'categorical' data type
boxchart(AutonomousRacer,AutonomousTimes,'BoxFaceColor','red','MarkerColor','red'); % Plot the box chart for autonomous racer
% Best lap times
text(3.7,63.45,[num2str(min(ManualTtimes)) ' s'],'Color','blue','FontName','Arial','FontSize',20); % Display the best lap time for human racers
text(10.2,62.6,[num2str(min(AutonomousTimes)) ' s'],'Color','red','FontName','Arial','FontSize',20); % Display the best lap time for human racers
% Average time lines
plot(ManualTimeMean,'--b'); % Average time line for human racers
text(10.3,64.7,[num2str(ManualTimeMean(1)) ' s'],'Color','blue','FontName','Arial','FontSize',20); % Display the mean lap time for human racers
plot(AutonomousTimeMean,'--r'); % Average time line for autonomous racer
text(9.9,63.24,[num2str(AutonomousTimeMean(1)) ' s'],'Color','red','FontName','Arial','FontSize',20); % Display the mean lap time for human racers
% Annotations
xlabel('Racer');
ylabel('Lap Time [sec]');
%legend('Manual Laps','Autonomous Laps','Mean Manual Lap Time','Mean Autonomous Lap Time','Location','southwest'); % Legend for the entire plot
set(gca,'FontName','Arial','FontSize',20); % Font for the entire plot