close all
clear all
clc

%% Setup
x = [1 1 1 2 2 2 4 4 4 8 8 8 16 16 16];
y = [1 10 100 1 10 100 1 10 100 1 10 100 1 10 100];

%w = postgreSQL sans index
z = [21.9884 17.7926 17.477875 35.0993 20.50742 20.2429905 46.4254 32.47261 60.79028325 112.5087625 85.97759625 109.1950675 125.1214187 164.2417025 197.614023];
%z = SQLite sans index
w = [5.82 4.648440001 4.363905 13.2418 8.525235 8.8946215 20.9488 20.724305 27.124623 65.5046875 68.1318675 54.121952 115.5187938 113.6181931 103.9685138];

%% Plot avec index
figure
% create coordinate matrices using meshgrid
[X, Y] = meshgrid(unique(x), unique(y));

% reshape z and w data into matrix form
Z = reshape(z, numel(unique(y)), numel(unique(x)));
W = reshape(w, numel(unique(y)), numel(unique(x)));

% create first surface plot
hSurface = surf(X, Y, Z);
set(hSurface, 'FaceColor',[1 0 0], 'FaceAlpha',0.5, 'EdgeAlpha', 0);
%colormap('winter'); % set color map
%shading('interp'); % set shading to interpolate colors
hold on

% create second surface plot and set transparency
hSurface2 = surf(X, Y, W);

% add legend
legend('Temps moyen avec PostgreSQL (sans index)','Temps moyen avec SQLite' )
% add labels
xlabel("Nombre de fil d'exécution");
ylabel("Nombre d'itération par requête");
zlabel('Temps moyen (ms)');
title('Performance des 2 différents SGBD');

