## Creating a leaderboard and scoring system

on 26 Nov 2018
Hello and sorry if my question might sound hard to understand at first!
Me and some coursemates went flying on a uni simulator which gave us different parameters under the form of arrays ( for example, altitude, time etc)
We had to create a program that takes those parameters, plots them into graphs and determines who was the best pilot.
I thought about using a scoring system similar to the ones in games, where at the end of each evaluation the data will be sorted in a hierarchical way.
For example taking the Altitude/Time graph, I had to determine the area underneath that graph, which I found out using the trapz function, afterwards I sorted ascending all that data, and the pilot with the smallest area is declared the winner of that round. All fun and games until here... -ish.
We were 6 pilots, therefore place 1 received 5 points, place 2 received 4 points etc place 6 received 0 points. I want that each pilot to receive a variable ( For example, lets call a pilot John) that is equal to 0 at the beginning. If john won 3rd place, he has to receive therefore 3 points. I dont know how to create this, as all I did was just compute that area and sort it. I dont know how to assign each pilot that area and how to give him those points.
Here is some of my coding:
plot(time_1,alt_1,'r');
plot(time_2,alt_2,'b');
plot(time_3,alt_3,'g');
plot(time_4,alt_4,'y');
plot(time_5,alt_5,'k');
plot(time_6,alt_6,'m');
title('Altitude variation over time');
xlabel('Time(s)');
ylabel('Altitude(m)');
legend('Andrei','Mauro','John','Khalid','Melbin','Sully')
hold off;
area1=trapz(time_1,alt_1);
area2=trapz(time_2,alt_2);
area3=trapz(time_3,alt_3);
area4=trapz(time_4,alt_4);
area5=trapz(time_5,alt_5);
area6=trapz(time_6,alt_6);
area_array=[area1,area2,area3,area4,area5,area6];
area_sorted=sort(area_array,'ascend');
area_sorted;
Help would be much appreciated!