clear all, close all

file_20MHz_mcs3_2Mbps ={'20MHz_mcs3_25_2Mbps.dat', '20MHz_mcs3_50_2Mbps.dat', '20MHz_mcs3_75_2Mbps.dat', '20MHz_mcs3_100_2Mbps.dat', '20MHz_mcs3_125_2Mbps.dat', '20MHz_mcs3_150_2Mbps.dat'};
file_40MHz_mcs3_2Mbps ={'40MHz_mcs3_25_2Mbps.dat', '40MHz_mcs3_50_2Mbps.dat', '40MHz_mcs3_75_2Mbps.dat', '40MHz_mcs3_100_2Mbps.dat', '40MHz_mcs3_125_2Mbps.dat', '40MHz_mcs3_150_2Mbps.dat'};
file_80MHz_mcs3_2Mbps ={'80MHz_mcs3_25_2Mbps.dat', '80MHz_mcs3_50_2Mbps.dat', '80MHz_mcs3_75_2Mbps.dat', '80MHz_mcs3_100_2Mbps.dat', '80MHz_mcs3_125_2Mbps.dat', '80MHz_mcs3_150_2Mbps.dat'};
file_160MHz_mcs3_2Mbps ={'160MHz_mcs3_25_2Mbps.dat', '160MHz_mcs3_50_2Mbps.dat', '160MHz_mcs3_75_2Mbps.dat', '160MHz_mcs3_100_2Mbps.dat', '160MHz_mcs3_125_2Mbps.dat', '160MHz_mcs3_150_2Mbps.dat'};

file_20MHz_mcs5_2Mbps ={'20MHz_mcs5_25_2Mbps.dat', '20MHz_mcs5_50_2Mbps.dat', '20MHz_mcs5_75_2Mbps.dat', '20MHz_mcs5_100_2Mbps.dat', '20MHz_mcs5_125_2Mbps.dat', '20MHz_mcs5_150_2Mbps.dat'};
file_40MHz_mcs5_2Mbps ={'40MHz_mcs5_25_2Mbps.dat', '40MHz_mcs5_50_2Mbps.dat', '40MHz_mcs5_75_2Mbps.dat', '40MHz_mcs5_100_2Mbps.dat', '40MHz_mcs5_125_2Mbps.dat', '40MHz_mcs5_150_2Mbps.dat'};
file_80MHz_mcs5_2Mbps ={'80MHz_mcs5_25_2Mbps.dat', '80MHz_mcs5_50_2Mbps.dat', '80MHz_mcs5_75_2Mbps.dat', '80MHz_mcs5_100_2Mbps.dat', '80MHz_mcs5_125_2Mbps.dat', '80MHz_mcs5_150_2Mbps.dat'};
file_160MHz_mcs5_2Mbps ={'160MHz_mcs5_25_2Mbps.dat', '160MHz_mcs5_50_2Mbps.dat', '160MHz_mcs5_75_2Mbps.dat', '160MHz_mcs5_100_2Mbps.dat', '160MHz_mcs5_125_2Mbps.dat', '160MHz_mcs5_150_2Mbps.dat'};

file_20MHz_mcs8_2Mbps ={'20MHz_mcs8_25_2Mbps.dat', '20MHz_mcs8_50_2Mbps.dat', '20MHz_mcs8_75_2Mbps.dat', '20MHz_mcs8_100_2Mbps.dat', '20MHz_mcs8_125_2Mbps.dat', '20MHz_mcs8_150_2Mbps.dat'};
file_40MHz_mcs8_2Mbps ={'40MHz_mcs8_25_2Mbps.dat', '40MHz_mcs8_50_2Mbps.dat', '40MHz_mcs8_75_2Mbps.dat', '40MHz_mcs8_100_2Mbps.dat', '40MHz_mcs8_125_2Mbps.dat', '40MHz_mcs8_150_2Mbps.dat'};
file_80MHz_mcs8_2Mbps ={'80MHz_mcs8_25_2Mbps.dat', '80MHz_mcs8_50_2Mbps.dat', '80MHz_mcs8_75_2Mbps.dat', '80MHz_mcs8_100_2Mbps.dat', '80MHz_mcs8_125_2Mbps.dat', '80MHz_mcs8_150_2Mbps.dat'};
file_160MHz_mcs8_2Mbps ={'160MHz_mcs8_25_2Mbps.dat', '160MHz_mcs8_50_2Mbps.dat', '160MHz_mcs8_75_2Mbps.dat', '160MHz_mcs8_100_2Mbps.dat', '160MHz_mcs8_125_2Mbps.dat', '160MHz_mcs8_150_2Mbps.dat'};

through20_3=NaN(6,150); through40_3=NaN(6,150); through80_3=NaN(6,150); through160_3=NaN(6,150); 
through20_5=NaN(6,150); through40_5=NaN(6,150); through80_5=NaN(6,150); through160_5=NaN(6,150);
through20_8=NaN(6,150); through40_8=NaN(6,150); through80_8=NaN(6,150); through160_8=NaN(6,150);

packets20_3=NaN(6,150); packets40_3=NaN(6,150); packets80_3=NaN(6,150); packets160_3=NaN(6,150); 
packets20_5=NaN(6,150); packets40_5=NaN(6,150); packets80_5=NaN(6,150); packets160_5=NaN(6,150);
packets20_8=NaN(6,150); packets40_8=NaN(6,150); packets80_8=NaN(6,150); packets160_8=NaN(6,150);


for i=1:6
%% MCS3     
    %% 20MHz
    clear throughput20_3;
    fileID = fopen(file_20MHz_mcs3_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_20MHz = datacell{1};
    n=dat_20MHz(1,:);
    
    for j=1:n
        throughput20_3(j)=dat_20MHz(2*j+1,:);
        through20_3(i,j)=dat_20MHz(2*j+1,:);
        packets20_3(i,j)=dat_20MHz(2*j,:);
    end  
    MHz20_mcs3_2Mbps(1,i)=mean(throughput20_3); 
    MHz20_mcs3_2Mbps(2,i)=max(throughput20_3);  
    MHz20_mcs3_2Mbps(3,i)=min(throughput20_3);
    MHz20_mcs3_2Mbps_Aggr(i)=(sum(packets20_3(i,1:(i*25)))*8*1472/(1024*1024*10)); 
    
    %% 40MHz
    clear throughput40_3;
    fileID = fopen(file_40MHz_mcs3_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_40MHz = datacell{1};
    n=dat_40MHz(1,:);
    for j=1:n
        throughput40_3(j)=dat_40MHz(2*j+1,:);
        through40_3(i,j)=dat_40MHz(2*j+1,:);
        packets40_3(i,j)=dat_40MHz(2*j,:);
    end  
    MHz40_mcs3_2Mbps(1,i)=mean(throughput40_3); 
    MHz40_mcs3_2Mbps(2,i)=max(throughput40_3);  
    MHz40_mcs3_2Mbps(3,i)=min(throughput40_3);  
    MHz40_mcs3_2Mbps_Aggr(i)=(sum(packets40_3(i,1:(i*25)))*8*1472/(1024*1024*10)); 
     %% 80MHz
    clear throughput80_3;
    fileID = fopen(file_80MHz_mcs3_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_80MHz = datacell{1};
    n=dat_80MHz(1,:);
    for j=1:n
        throughput80_3(j)=dat_80MHz(2*j+1,:);
        through80_3(i,j)=dat_80MHz(2*j+1,:);
        packets80_3(i,j)=dat_80MHz(2*j,:);
    end  
    MHz80_mcs3_2Mbps(1,i)=mean(throughput80_3); 
    MHz80_mcs3_2Mbps(2,i)=max(throughput80_3);  
    MHz80_mcs3_2Mbps(3,i)=min(throughput80_3);  
    MHz80_mcs3_2Mbps_Aggr(i)=(sum(packets80_3(i,1:(i*25)))*8*1472/(1024*1024*10)); 
     %% 160MHz
    clear throughput160_3;
    fileID = fopen(file_160MHz_mcs3_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_160MHz = datacell{1};
    n=dat_160MHz(1,:);
    for j=1:n
        throughput160_3(j)=dat_160MHz(2*j+1,:);
        through160_3(i,j)=dat_160MHz(2*j+1,:);
        packets160_3(i,j)=dat_160MHz(2*j,:);
    end  
    MHz160_mcs3_2Mbps(1,i)=mean(throughput160_3); 
    MHz160_mcs3_2Mbps(2,i)=max(throughput160_3);  
    MHz160_mcs3_2Mbps(3,i)=min(throughput160_3);  
    MHz160_mcs3_2Mbps_Aggr(i)=(sum(packets160_3(i,1:(i*25)))*8*1472/(1024*1024*10)); 
%% MCS5 
    %% 20MHz
    clear throughput20_5;
    fileID = fopen(file_20MHz_mcs5_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_20MHz = datacell{1};
    n=dat_20MHz(1,:);
    for j=1:n
        throughput20_5(j)=dat_20MHz(2*j+1,:);
        through20_5(i,j)=dat_20MHz(2*j+1,:);
        packets20_5(i,j)=dat_20MHz(2*j,:);
    end  
    MHz20_mcs5_2Mbps(1,i)=mean(throughput20_5); 
    MHz20_mcs5_2Mbps(2,i)=max(throughput20_5);  
    MHz20_mcs5_2Mbps(3,i)=min(throughput20_5);  
    MHz20_mcs5_2Mbps_Aggr(i)=(sum(packets20_5(i,1:(i*25)))*8*1472/(1024*1024*10));
    
    %% 40MHz
    clear throughput40_5;
    fileID = fopen(file_40MHz_mcs5_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_40MHz = datacell{1};
    n=dat_40MHz(1,:);
    for j=1:n
        throughput40_5(j)=dat_40MHz(2*j+1,:);
        through40_5(i,j)=dat_40MHz(2*j+1,:);
        packets40_5(i,j)=dat_40MHz(2*j,:);
    end  
    MHz40_mcs5_2Mbps(1,i)=mean(throughput40_5); 
    MHz40_mcs5_2Mbps(2,i)=max(throughput40_5);  
    MHz40_mcs5_2Mbps(3,i)=min(throughput40_5);  
    MHz40_mcs5_2Mbps_Aggr(i)=(sum(packets40_5(i,1:(i*25)))*8*1472/(1024*1024*10));
     %% 80MHz
    clear throughput80_5;
    fileID = fopen(file_80MHz_mcs5_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_80MHz = datacell{1};
    n=dat_80MHz(1,:);
    for j=1:n
        throughput80_5(j)=dat_80MHz(2*j+1,:);
        through80_5(i,j)=dat_80MHz(2*j+1,:);
        packets80_5(i,j)=dat_80MHz(2*j,:);
    end  
    MHz80_mcs5_2Mbps(1,i)=mean(throughput80_5); 
    MHz80_mcs5_2Mbps(2,i)=max(throughput80_5);  
    MHz80_mcs5_2Mbps(3,i)=min(throughput80_5);  
    MHz80_mcs5_2Mbps_Aggr(i)=(sum(packets80_5(i,1:(i*25)))*8*1472/(1024*1024*10));
     %% 160MHz
    clear throughput160_5;
    fileID = fopen(file_160MHz_mcs5_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_160MHz = datacell{1};
    n=dat_160MHz(1,:);
    for j=1:n
        throughput160_5(j)=dat_160MHz(2*j+1,:);
        through160_5(i,j)=dat_160MHz(2*j+1,:);
        packets160_5(i,j)=dat_160MHz(2*j,:);
    end  
    MHz160_mcs5_2Mbps(1,i)=mean(throughput160_5); 
    MHz160_mcs5_2Mbps(2,i)=max(throughput160_5);  
    MHz160_mcs5_2Mbps(3,i)=min(throughput160_5);  
    MHz160_mcs5_2Mbps_Aggr(i)=(sum(packets160_5(i,1:(i*25)))*8*1472/(1024*1024*10));      
%% MCS8 
    %% 20MHz
    clear throughput20_8;
    fileID = fopen(file_20MHz_mcs8_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_20MHz = datacell{1};
    n=dat_20MHz(1,:);
    for j=1:n
        throughput20_8(j)=dat_20MHz(2*j+1,:);
        through20_8(i,j)=dat_20MHz(2*j+1,:);
        packets20_8(i,j)=dat_20MHz(2*j,:);
    end  
    MHz20_mcs8_2Mbps(1,i)=mean(throughput20_8); 
    MHz20_mcs8_2Mbps(2,i)=max(throughput20_8);  
    MHz20_mcs8_2Mbps(3,i)=min(throughput20_8);  
    MHz20_mcs8_2Mbps_Aggr(i)=(sum(packets20_8(i,1:(i*25)))*8*1472/(1024*1024*10)); 
    
    %% 40MHz
    clear throughput40_8;
    fileID = fopen(file_40MHz_mcs8_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_40MHz = datacell{1};
    n=dat_40MHz(1,:);
    for j=1:n
        throughput40_8(j)=dat_40MHz(2*j+1,:);
        through40_8(i,j)=dat_40MHz(2*j+1,:);
        packets40_8(i,j)=dat_40MHz(2*j,:);
    end  
    MHz40_mcs8_2Mbps(1,i)=mean(throughput40_8); 
    MHz40_mcs8_2Mbps(2,i)=max(throughput40_8);  
    MHz40_mcs8_2Mbps(3,i)=min(throughput40_8);  
    MHz40_mcs8_2Mbps_Aggr(i)=(sum(packets40_8(i,1:(i*25)))*8*1472/(1024*1024*10)); 
     %% 80MHz
    clear throughput80_8;
    fileID = fopen(file_80MHz_mcs8_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_80MHz = datacell{1};
    n=dat_80MHz(1,:);
    for j=1:n
        throughput80_8(j)=dat_80MHz(2*j+1,:);
        through80_8(i,j)=dat_80MHz(2*j+1,:);
        packets80_8(i,j)=dat_80MHz(2*j,:);
    end  
    MHz80_mcs8_2Mbps(1,i)=mean(throughput80_8); 
    MHz80_mcs8_2Mbps(2,i)=max(throughput80_8);  
    MHz80_mcs8_2Mbps(3,i)=min(throughput80_8);  
    MHz80_mcs8_2Mbps_Aggr(i)=(sum(packets80_8(i,1:(i*25)))*8*1472/(1024*1024*10)); 
     %% 160MHz
    clear throughput160_8;
    fileID = fopen(file_160MHz_mcs8_2Mbps{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_160MHz = datacell{1};
    n=dat_160MHz(1,:);
    for j=1:n
        throughput160_8(j)=dat_160MHz(2*j+1,:);
        through160_8(i,j)=dat_160MHz(2*j+1,:);
        packets160_8(i,j)=dat_160MHz(2*j,:);
    end  
    MHz160_mcs8_2Mbps(1,i)=mean(throughput160_8); 
    MHz160_mcs8_2Mbps(2,i)=max(throughput160_8);  
    MHz160_mcs8_2Mbps(3,i)=min(throughput160_8);  
    MHz160_mcs8_2Mbps_Aggr(i)=(sum(packets160_8(i,1:(i*25)))*8*1472/(1024*1024*10));  
end

X_axis = 25:25:150;

figure('name','Priemerná priepustnos� na klienta: MCS 3','Position', [50, 450, 790, 550])

plot(X_axis,MHz20_mcs3_2Mbps(1,:),'-o','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs3_2Mbps(1,:),'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs3_2Mbps(1,:),'-d','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs3_2Mbps(1,:),'-s','LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
leg=legend('kanál 20 MHz','kanál 40 MHz','kanál 80 MHz','kanál 160 MHz','Location','southwest');
set(leg,'FontSize',12 ); grid on
title('Priemerná priepustno� na klienta: aktívnych klientov 100%, MCS 3','FontSize',14)
xlabel('Poèet asociovaných klientov','FontSize',14)
ylabel('Priepustnos� [Mbit/s]','FontSize',14)

figure('name','Priemerná priepustnos� na klienta: MCS 5','Position', [50, 450, 790, 550])
plot(X_axis,MHz20_mcs5_2Mbps(1,:),'-o','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs5_2Mbps(1,:),'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs5_2Mbps(1,:),'-d','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs5_2Mbps(1,:),'-s','LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
leg=legend('kanál 20 MHz','kanál 40 MHz','kanál 80 MHz','kanál 160 MHz','Location','southwest');
set(leg,'FontSize',12 ); grid on
title('Priemerná priepustno� na klienta: aktívnych klientov 100%, MCS 5','FontSize',14)
xlabel('Poèet asociovaných klientov','FontSize',14)
ylabel('Priepustnos� [Mbit/s]','FontSize',14)

figure('name','Priemerná priepustnos� na klienta: MCS 8','Position', [50, 450, 790, 550])
plot(X_axis,MHz20_mcs8_2Mbps(1,:),'-o','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs8_2Mbps(1,:),'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs8_2Mbps(1,:),'-d','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs8_2Mbps(1,:),'-s','LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
leg=legend('kanál 20 MHz','kanál 40 MHz','kanál 80 MHz','kanál 160 MHz','Location','southwest');
set(leg,'FontSize',12 ); grid on
title('Priemerná priepustnos� na klienta: aktívnych klientov 100%, MCS 8','FontSize',14)
xlabel('Poèet asociovaných klientov','FontSize',14)
ylabel('Priepustnos� [Mbit/s]','FontSize',14)

%% Subplots
figure('name','Priemerná priepustnos� na klienta: MCS 8','Position', [50, 50, 1180, 870])
%% kanál 20 MHz
subplot(2,2,1);
plot(X_axis,MHz20_mcs3_2Mbps(1,:),'-o','Color',[1 0.4 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz20_mcs5_2Mbps(1,:),'-v','Color',[0.2 0.8 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz20_mcs8_2Mbps(1,:),'-d','Color',[0.2 0.4 1],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
ylim([0.25 2.25]);
leg=legend('MCS3 (16-QAM 1/2)','MCS5 (64-QAM 2/3)','MCS8 (256-QAM 3/4)','Location','northeast');
set(leg,'FontSize',10 ); grid on
title('kanál 20 MHz','FontSize',12,'FontWeight','normal' )
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Priepustnos� [Mbit/s]','FontSize',12)
%% kanál 40 MHz
subplot(2,2,2);
plot(X_axis,MHz40_mcs3_2Mbps(1,:),'-o','Color',[1 0.4 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs5_2Mbps(1,:),'-v','Color',[0.2 0.8 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs8_2Mbps(1,:),'-d','Color',[0.2 0.4 1],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
ylim([0.25 2.25]);
leg=legend('MCS3 (16-QAM 1/2)','MCS5 (64-QAM 2/3)','MCS8 (256-QAM 3/4)','Location','southwest');
set(leg,'FontSize',10 ); grid on;
title('kanál 40 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Priepustnos� [Mbit/s]','FontSize',12)
%% kanál 80 MHz
subplot(2,2,3);
plot(X_axis,MHz80_mcs3_2Mbps(1,:),'-o','Color',[1 0.4 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs5_2Mbps(1,:),'-v','Color',[0.2 0.8 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs8_2Mbps(1,:),'-d','Color',[0.2 0.4 1],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
ylim([0.25 2.25]);
leg=legend('MCS3 (16-QAM 1/2)','MCS5 (64-QAM 2/3)','MCS8 (256-QAM 3/4)','Location','southwest'); 
set(leg,'FontSize',10 ); grid on
title('kanál 80 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Priepustnos� [Mbit/s]','FontSize',12)
%% kanál 160 MHz
subplot(2,2,4);
plot(X_axis,MHz160_mcs3_2Mbps(1,:),'-o','Color',[1 0.4 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs5_2Mbps(1,:),'-v','Color',[0.2 0.8 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs8_2Mbps(1,:),'-d','Color',[0.2 0.4 1],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
ylim([0.25 2.25]);
leg=legend('MCS3 (16-QAM 1/2)','MCS5 (64-QAM 2/3)','MCS8 (256-QAM 3/4)','Location','southwest');
set(leg,'FontSize',10 ); grid on 
title('kanál 160 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Priepustnos� [Mbit/s]','FontSize',12)
suptitle('Priemerná priepustnos� na klienta: aktívnych klientov 100%',14) ;

%% Subplots
figure('name','Agregovaná priepustnos�: MCS 3, 5 a 8','Position', [50, 50, 1180, 870])
%% kanál 20 MHz
subplot(2,2,1);
plot(X_axis,MHz20_mcs3_2Mbps_Aggr,'-o','Color',[1 0.4 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz20_mcs5_2Mbps_Aggr,'-v','Color',[0.2 0.8 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz20_mcs8_2Mbps_Aggr,'-d','Color',[0.2 0.4 1],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
leg=legend('MCS3 (16-QAM 1/2)','MCS5 (64-QAM 2/3)','MCS8 (256-QAM 3/4)','Location','southeast');
set(leg,'FontSize',10 ); grid on
title('kanál 20 MHz','FontSize',12,'FontWeight','normal' )
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Agregovaná priepustnos� [Mbit/s]','FontSize',12)
%% kanál 40 MHz
subplot(2,2,2);
plot(X_axis,MHz40_mcs3_2Mbps_Aggr,'-o','Color',[1 0.4 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs5_2Mbps_Aggr,'-v','Color',[0.2 0.8 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs8_2Mbps_Aggr,'-d','Color',[0.2 0.4 1],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
leg=legend('MCS3 (16-QAM 1/2)','MCS5 (64-QAM 2/3)','MCS8 (256-QAM 3/4)','Location','southeast');
set(leg,'FontSize',10 ); grid on;
title('kanál 40 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Agregovaná priepustnos� [Mbit/s]','FontSize',12)
%% kanál 80 MHz
subplot(2,2,3);
plot(X_axis,MHz80_mcs3_2Mbps_Aggr,'-o','Color',[1 0.4 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs5_2Mbps_Aggr,'-v','Color',[0.2 0.8 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs8_2Mbps_Aggr,'-d','Color',[0.2 0.4 1],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
leg=legend('MCS3 (16-QAM 1/2)','MCS5 (64-QAM 2/3)','MCS8 (256-QAM 3/4)','Location','southeast'); 
set(leg,'FontSize',10 ); grid on
title('kanál 80 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Agregovaná priepustnos� [Mbit/s]','FontSize',12)
%% kanál 160 MHz
subplot(2,2,4);
plot(X_axis,MHz160_mcs3_2Mbps_Aggr,'-o','Color',[1 0.4 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs5_2Mbps_Aggr,'-v','Color',[0.2 0.8 0],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs8_2Mbps_Aggr,'-d','Color',[0.2 0.4 1],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
leg=legend('MCS3 (16-QAM 1/2)','MCS5 (64-QAM 2/3)','MCS8 (256-QAM 3/4)','Location','southeast');
set(leg,'FontSize',10 ); grid on 
title('kanál 160 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Priepustnos� [Mbit/s]','FontSize',12)
suptitle('Agregovaná priepustnos�: aktívnych klientov 100%',14) ;

for loop=1:6
    X(loop)=25*loop;
    %%20 MHz kanal
    MHz20_x_3(loop)=max(through20_3(through20_3(loop,:)>-1));
    MHz20_x9_3(loop)=MHz20_x_3(loop)*0.9; MHz20_x10_3(loop)=MHz20_x_3(loop)*0.1;
    MHz20_y10_3(loop)=length(through20_3(through20_3(loop,:)<=MHz20_x10_3(loop)));
    MHz20_y9_3(loop)=length(through20_3(through20_3(loop,:)>MHz20_x9_3(loop)));
        
    MHz20_x_5(loop)=max(through20_5(through20_5(loop,:)>-1));
    MHz20_x9_5(loop)=MHz20_x_5(loop)*0.9; MHz20_x10_5(loop)=MHz20_x_5(loop)*0.1;
    MHz20_y10_5(loop)=length(through20_5(through20_5(loop,:)<=MHz20_x10_5(loop)));
    MHz20_y9_5(loop)=length(through20_5(through20_5(loop,:)>MHz20_x9_5(loop)));
        
    MHz20_x_8(loop)=max(through20_8(through20_8(loop,:)>-1));
    MHz20_x9_8(loop)=MHz20_x_8(loop)*0.9; MHz20_x10_8(loop)=MHz20_x_8(loop)*0.1;
    MHz20_y10_8(loop)=length(through20_8(through20_8(loop,:)<=MHz20_x10_8(loop)));
    MHz20_y9_8(loop)=length(through20_8(through20_8(loop,:)>MHz20_x9_8(loop)));
    
    %%40 MHz kanal
    MHz40_x_3(loop)=max(through40_3(through40_3(loop,:)>-1));
    MHz40_x9_3(loop)=MHz40_x_3(loop)*0.9; MHz40_x10_3(loop)=MHz40_x_3(loop)*0.1;
    MHz40_y10_3(loop)=length(through40_3(through40_3(loop,:)<=MHz40_x10_3(loop)));
    MHz40_y9_3(loop)=length(through40_3(through40_3(loop,:)>MHz40_x9_3(loop)));
        
    MHz40_x_5(loop)=max(through40_5(through40_5(loop,:)>-1));
    MHz40_x9_5(loop)=MHz40_x_5(loop)*0.9; MHz40_x10_5(loop)=MHz40_x_5(loop)*0.1;
    MHz40_y10_5(loop)=length(through40_5(through40_5(loop,:)<=MHz40_x10_5(loop)));
    MHz40_y9_5(loop)=length(through40_5(through40_5(loop,:)>MHz40_x9_5(loop)));
        
    MHz40_x_8(loop)=max(through40_8(through40_8(loop,:)>-1));
    MHz40_x9_8(loop)=MHz40_x_8(loop)*0.9; MHz40_x10_8(loop)=MHz40_x_8(loop)*0.1;
    MHz40_y10_8(loop)=length(through40_8(through40_8(loop,:)<=MHz40_x10_8(loop)));
    MHz40_y9_8(loop)=length(through40_8(through40_8(loop,:)>MHz40_x9_8(loop)));
    
      %%80 MHz kanal
    MHz80_x_3(loop)=max(through80_3(through80_3(loop,:)>-1));
    MHz80_x9_3(loop)=MHz80_x_3(loop)*0.9; MHz80_x10_3(loop)=MHz80_x_3(loop)*0.1;
    MHz80_y10_3(loop)=length(through80_3(through80_3(loop,:)<=MHz80_x10_3(loop)));
    MHz80_y9_3(loop)=length(through80_3(through80_3(loop,:)>MHz80_x9_3(loop)));
        
    MHz80_x_5(loop)=max(through80_5(through80_5(loop,:)>-1));
    MHz80_x9_5(loop)=MHz80_x_5(loop)*0.9; MHz80_x10_5(loop)=MHz80_x_5(loop)*0.1;
    MHz80_y10_5(loop)=length(through80_5(through80_5(loop,:)<=MHz80_x10_5(loop)));
    MHz80_y9_5(loop)=length(through80_5(through80_5(loop,:)>MHz80_x9_5(loop)));
        
    MHz80_x_8(loop)=max(through80_8(through80_8(loop,:)>-1));
    MHz80_x9_8(loop)=MHz80_x_8(loop)*0.9; MHz80_x10_8(loop)=MHz80_x_8(loop)*0.1;
    MHz80_y10_8(loop)=length(through80_8(through80_8(loop,:)<=MHz80_x10_8(loop)));
    MHz80_y9_8(loop)=length(through80_8(through80_8(loop,:)>MHz80_x9_8(loop)));
    
        %%160 MHz kanal
    MHz160_x_3(loop)=max(through160_3(through160_3(loop,:)>-1));
    MHz160_x9_3(loop)=MHz160_x_3(loop)*0.9; MHz160_x10_3(loop)=MHz160_x_3(loop)*0.1;
    MHz160_y10_3(loop)=length(through160_3(through160_3(loop,:)<=MHz160_x10_3(loop)));
    MHz160_y9_3(loop)=length(through160_3(through160_3(loop,:)>MHz160_x9_3(loop)));
        
    MHz160_x_5(loop)=max(through160_5(through160_5(loop,:)>-1));
    MHz160_x9_5(loop)=MHz160_x_5(loop)*0.9; MHz160_x10_5(loop)=MHz160_x_5(loop)*0.1;
    MHz160_y10_5(loop)=length(through160_5(through160_5(loop,:)<=MHz160_x10_5(loop)));
    MHz160_y9_5(loop)=length(through160_5(through160_5(loop,:)>MHz160_x9_5(loop)));
        
    MHz160_x_8(loop)=max(through160_8(through160_8(loop,:)>-1));
    MHz160_x9_8(loop)=MHz160_x_8(loop)*0.9; MHz160_x10_8(loop)=MHz160_x_8(loop)*0.1;
    MHz160_y10_8(loop)=length(through160_8(through160_8(loop,:)<=MHz160_x10_8(loop)));
    MHz160_y9_8(loop)=length(through160_8(through160_8(loop,:)>MHz160_x9_8(loop)));
    
end

figure('name','Normovaná priepustnos�:','Position', [50, 50, 1180, 870])
subplot(2,2,1)
plot(X,MHz20_y10_3./X,':x','MarkerSize',8,'LineWidth',2,'Color',[1 0.4 0])
hold on
plot(X,MHz20_y9_3./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[1 0.4 0])
hold on
plot(X,MHz20_y10_5./X,':x','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.8 0])
hold on
plot(X,MHz20_y9_5./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.8 0])
hold on
plot(X,MHz20_y10_8./X,':x','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.4 1])
hold on
plot(X,MHz20_y9_8./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.4 1])
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
grid on
title('kanál 20 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Normovaná priepustnos�','FontSize',12)

subplot(2,2,2)
plot(X,MHz40_y10_3./X,':x','MarkerSize',8,'LineWidth',2,'Color',[1 0.4 0])
hold on
plot(X,MHz40_y9_3./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[1 0.4 0])
hold on
plot(X,MHz40_y10_5./X,':x','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.8 0])
hold on
plot(X,MHz40_y9_5./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.8 0])
hold on
plot(X,MHz40_y10_8./X,':x','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.4 1])
hold on
plot(X,MHz40_y9_8./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.4 1])

grid on
title('kanál 40 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Normovaná priepustnos�','FontSize',12)
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);

subplot(2,2,3)
plot(X,MHz80_y10_3./X,':x','MarkerSize',8,'LineWidth',2,'Color',[1 0.4 0])
hold on
plot(X,MHz80_y9_3./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[1 0.4 0])
hold on
plot(X,MHz80_y10_5./X,':x','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.8 0])
hold on
plot(X,MHz80_y9_5./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.8 0])
hold on
plot(X,MHz80_y10_8./X,':x','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.4 1])
hold on
plot(X,MHz80_y9_8./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.4 1])
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
grid on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
title('kanál 80 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Normovaná priepustnos�','FontSize',12)


subplot(2,2,4)
plot(X,MHz160_y10_3./X,':x','MarkerSize',8,'LineWidth',2,'Color',[1 0.4 0])
hold on
plot(X,MHz160_y9_3./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[1 0.4 0])
hold on
plot(X,MHz160_y10_5./X,':x','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.8 0])
hold on
plot(X,MHz160_y9_5./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.8 0])
hold on
plot(X,MHz160_y10_8./X,':x','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.4 1])
hold on
plot(X,MHz160_y9_8./X,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.2 0.4 1])
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12);
grid on
title('kanál 160 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Normovaná priepustnos�','FontSize',12)
legend('P_k< 10% P_{kMAX}, MCS 3','P_k > 90% P_{kMAX}, MCS 3',...
       'P_k < 10% P_{kMAX}, MCS 5','P_k > 90% P_{kMAX}, MCS 5',...
       'P_k < 10% P_{kMAX}, MCS 8','P_k > 90% P_{kMAX}, MCS 8','Location','west')
suptitle('Normovaná priepustnos�: aktívnych klientov 100%, ',14) ;

