clear all, close all

file_20MHz_mcs8_2Mbps_50 ={'20MHz_mcs8_25_2Mbps_50.dat', '20MHz_mcs8_50_2Mbps_50.dat', '20MHz_mcs8_75_2Mbps_50.dat', '20MHz_mcs8_100_2Mbps_50.dat', '20MHz_mcs8_125_2Mbps_50.dat', '20MHz_mcs8_150_2Mbps_50.dat'};
file_40MHz_mcs8_2Mbps_50 ={'40MHz_mcs8_25_2Mbps_50.dat', '40MHz_mcs8_50_2Mbps_50.dat', '40MHz_mcs8_75_2Mbps_50.dat', '40MHz_mcs8_100_2Mbps_50.dat', '40MHz_mcs8_125_2Mbps_50.dat', '40MHz_mcs8_150_2Mbps_50.dat'};
file_80MHz_mcs8_2Mbps_50 ={'80MHz_mcs8_25_2Mbps_50.dat', '80MHz_mcs8_50_2Mbps_50.dat', '80MHz_mcs8_75_2Mbps_50.dat', '80MHz_mcs8_100_2Mbps_50.dat', '80MHz_mcs8_125_2Mbps_50.dat', '80MHz_mcs8_150_2Mbps_50.dat'};
file_160MHz_mcs8_2Mbps_50 ={'160MHz_mcs8_25_2Mbps_50.dat', '160MHz_mcs8_50_2Mbps_50.dat', '160MHz_mcs8_75_2Mbps_50.dat', '160MHz_mcs8_100_2Mbps_50.dat', '160MHz_mcs8_125_2Mbps_50.dat', '160MHz_mcs8_150_2Mbps_50.dat'};

file_20MHz_mcs8_2Mbps_70 ={'20MHz_mcs8_25_2Mbps_70.dat', '20MHz_mcs8_50_2Mbps_70.dat', '20MHz_mcs8_75_2Mbps_70.dat', '20MHz_mcs8_100_2Mbps_70.dat', '20MHz_mcs8_125_2Mbps_70.dat', '20MHz_mcs8_150_2Mbps_70.dat'};
file_40MHz_mcs8_2Mbps_70 ={'40MHz_mcs8_25_2Mbps_70.dat', '40MHz_mcs8_50_2Mbps_70.dat', '40MHz_mcs8_75_2Mbps_70.dat', '40MHz_mcs8_100_2Mbps_70.dat', '40MHz_mcs8_125_2Mbps_70.dat', '40MHz_mcs8_150_2Mbps_70.dat'};
file_80MHz_mcs8_2Mbps_70 ={'80MHz_mcs8_25_2Mbps_70.dat', '80MHz_mcs8_50_2Mbps_70.dat', '80MHz_mcs8_75_2Mbps_70.dat', '80MHz_mcs8_100_2Mbps_70.dat', '80MHz_mcs8_125_2Mbps_70.dat', '80MHz_mcs8_150_2Mbps_70.dat'};
file_160MHz_mcs8_2Mbps_70 ={'160MHz_mcs8_25_2Mbps_70.dat', '160MHz_mcs8_50_2Mbps_70.dat', '160MHz_mcs8_75_2Mbps_70.dat', '160MHz_mcs8_100_2Mbps_70.dat', '160MHz_mcs8_125_2Mbps_70.dat', '160MHz_mcs8_150_2Mbps_70.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_50=NaN(6,150); through40_50=NaN(6,150); through80_50=NaN(6,150); through160_50=NaN(6,150); 
through20_70=NaN(6,150); through40_70=NaN(6,150); through80_70=NaN(6,150); through160_70=NaN(6,150);
through20_100=NaN(6,150); through40_100=NaN(6,150); through80_100=NaN(6,150); through160_100=NaN(6,150);

packets20_50=NaN(6,75); packets40_50=NaN(6,75); packets80_50=NaN(6,75); packets160_50=NaN(6,75); 
packets20_70=NaN(6,105); packets40_70=NaN(6,105); packets80_70=NaN(6,105); packets160_70=NaN(6,105);
packets20_100=NaN(6,150); packets40_100=NaN(6,150); packets80_100=NaN(6,150); packets160_100=NaN(6,150);



for i=1:6
%% 50% aktivnych klientov        
    %% 20MHz
    clear throughput20_50;
    fileID = fopen(file_20MHz_mcs8_2Mbps_50{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_20MHz = datacell{1};
    n=dat_20MHz(1,:);
    for j=1:n
        throughput20_50(j)=dat_20MHz(2*j+1,:);
		through20_50(i,j)=dat_20MHz(2*j+1,:);
        packets20_50(i,j)=dat_20MHz(2*j,:);
    end  
    MHz20_mcs8_2Mbps_50(1,i)=mean(throughput20_50); 
    MHz20_mcs8_2Mbps_50(2,i)=max(throughput20_50);  
    MHz20_mcs8_2Mbps_50(3,i)=min(throughput20_50);  
    MHz20_mcs8_2Mbps_50_Aggr(i)=(sum(packets20_50(i,1:(i*12+trunc(i/2,0))))*8*1472/(1024*1024*10)); 
    
    %% 40MHz
    clear throughput40_50;
    fileID = fopen(file_40MHz_mcs8_2Mbps_50{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_40MHz = datacell{1};
    n=dat_40MHz(1,:);
    for j=1:n
        throughput40_50(j)=dat_40MHz(2*j+1,:);
		through40_50(i,j)=dat_40MHz(2*j+1,:);
        packets40_50(i,j)=dat_40MHz(2*j,:);
    end  
    MHz40_mcs8_2Mbps_50(1,i)=mean(throughput40_50); 
    MHz40_mcs8_2Mbps_50(2,i)=max(throughput40_50);  
    MHz40_mcs8_2Mbps_50(3,i)=min(throughput40_50);  
    MHz40_mcs8_2Mbps_50_Aggr(i)=(sum(packets40_50(i,1:(i*12+trunc(i/2,0))))*8*1472/(1024*1024*10));
     %% 80MHz
    clear throughput80_50;
    fileID = fopen(file_80MHz_mcs8_2Mbps_50{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_80MHz = datacell{1};
    n=dat_80MHz(1,:);
    for j=1:n
        throughput80_50(j)=dat_80MHz(2*j+1,:);
		through80_50(i,j)=dat_80MHz(2*j+1,:);
        packets80_50(i,j)=dat_80MHz(2*j,:);
    end  
    MHz80_mcs8_2Mbps_50(1,i)=mean(throughput80_50); 
    MHz80_mcs8_2Mbps_50(2,i)=max(throughput80_50);  
    MHz80_mcs8_2Mbps_50(3,i)=min(throughput80_50);  
    MHz80_mcs8_2Mbps_50_Aggr(i)=(sum(packets80_50(i,1:(i*12+trunc(i/2,0))))*8*1472/(1024*1024*10));
     %% 160MHz
    clear throughput160_50;
    fileID = fopen(file_160MHz_mcs8_2Mbps_50{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_160MHz = datacell{1};
    n=dat_160MHz(1,:);
    for j=1:n
        throughput160_50(j)=dat_160MHz(2*j+1,:);
		through160_50(i,j)=dat_160MHz(2*j+1,:);
        packets160_50(i,j)=dat_160MHz(2*j,:);
    end  
    MHz160_mcs8_2Mbps_50(1,i)=mean(throughput160_50); 
    MHz160_mcs8_2Mbps_50(2,i)=max(throughput160_50);  
    MHz160_mcs8_2Mbps_50(3,i)=min(throughput160_50);  
    MHz160_mcs8_2Mbps_50_Aggr(i)=(sum(packets160_50(i,1:(i*12+trunc(i/2,0))))*8*1472/(1024*1024*10));
%% 70% aktivnych klientov    
    %% 20MHz
    clear throughput20_70;
    fileID = fopen(file_20MHz_mcs8_2Mbps_70{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_20MHz = datacell{1};
    n=dat_20MHz(1,:);
    for j=1:n
        throughput20_70(j)=dat_20MHz(2*j+1,:);
		through20_70(i,j)=dat_20MHz(2*j+1,:);
        packets20_70(i,j)=dat_20MHz(2*j,:);
    end  
    MHz20_mcs8_2Mbps_70(1,i)=mean(throughput20_70); 
    MHz20_mcs8_2Mbps_70(2,i)=max(throughput20_70);  
    MHz20_mcs8_2Mbps_70(3,i)=min(throughput20_70);  
    MHz20_mcs8_2Mbps_70_Aggr(i)=(sum(packets20_70(i,1:(i*17+trunc(i/2,0))))*8*1472/(1024*1024*10));
    
    %% 40MHz
    clear throughput40_70;
    fileID = fopen(file_40MHz_mcs8_2Mbps_70{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_40MHz = datacell{1};
    n=dat_40MHz(1,:);
    for j=1:n
        throughput40_70(j)=dat_40MHz(2*j+1,:);
		through40_70(i,j)=dat_40MHz(2*j+1,:);
        packets40_70(i,j)=dat_40MHz(2*j,:);
    end  
    MHz40_mcs8_2Mbps_70(1,i)=mean(throughput40_70); 
    MHz40_mcs8_2Mbps_70(2,i)=max(throughput40_70);  
    MHz40_mcs8_2Mbps_70(3,i)=min(throughput40_70);  
    MHz40_mcs8_2Mbps_70_Aggr(i)=(sum(packets40_70(i,1:(i*17+trunc(i/2,0))))*8*1472/(1024*1024*10));
     %% 80MHz
    clear throughput80_70;
    fileID = fopen(file_80MHz_mcs8_2Mbps_70{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_80MHz = datacell{1};
    n=dat_80MHz(1,:);
    for j=1:n
        throughput80_70(j)=dat_80MHz(2*j+1,:);
		through80_70(i,j)=dat_80MHz(2*j+1,:);
        packets80_70(i,j)=dat_80MHz(2*j,:);
    end  
    MHz80_mcs8_2Mbps_70(1,i)=mean(throughput80_70); 
    MHz80_mcs8_2Mbps_70(2,i)=max(throughput80_70);  
    MHz80_mcs8_2Mbps_70(3,i)=min(throughput80_70);  
    MHz80_mcs8_2Mbps_70_Aggr(i)=(sum(packets80_70(i,1:(i*17+trunc(i/2,0))))*8*1472/(1024*1024*10));
     %% 160MHz
    clear throughput160_70;
    fileID = fopen(file_160MHz_mcs8_2Mbps_70{1,i},'rt');
    datacell = textscan(fileID,'%f', 'CollectOutput',1);
    fclose(fileID);
    dat_160MHz = datacell{1};
    n=dat_160MHz(1,:);
    for j=1:n
        throughput160_70(j)=dat_160MHz(2*j+1,:);
		through160_70(i,j)=dat_160MHz(2*j+1,:);
        packets160_70(i,j)=dat_160MHz(2*j,:);
    end  
    MHz160_mcs8_2Mbps_70(1,i)=mean(throughput160_70); 
    MHz160_mcs8_2Mbps_70(2,i)=max(throughput160_70);  
    MHz160_mcs8_2Mbps_70(3,i)=min(throughput160_70);  
    MHz160_mcs8_2Mbps_70_Aggr(i)=(sum(packets160_70(i,1:(i*17+trunc(i/2,0))))*8*1472/(1024*1024*10));     
%% 100% aktivnych klientov    
    %% 20MHz
    clear throughput20_100;
    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_100(j)=dat_20MHz(2*j+1,:);
		through20_100(i,j)=dat_20MHz(2*j+1,:);
        packets20_100(i,j)=dat_20MHz(2*j,:);
    end  
    MHz20_mcs8_2Mbps(1,i)=mean(throughput20_100); 
    MHz20_mcs8_2Mbps(2,i)=max(throughput20_100);  
    MHz20_mcs8_2Mbps(3,i)=min(throughput20_100);  
    MHz20_mcs8_2Mbps_Aggr(i)=(sum(packets20_100(i,1:(i*25)))*8*1472/(1024*1024*10));
    
    %% 40MHz
    clear throughput40_100;
    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_100(j)=dat_40MHz(2*j+1,:);
		through40_100(i,j)=dat_40MHz(2*j+1,:);
        packets40_100(i,j)=dat_40MHz(2*j,:);
    end  
    MHz40_mcs8_2Mbps(1,i)=mean(throughput40_100); 
    MHz40_mcs8_2Mbps(2,i)=max(throughput40_100);  
    MHz40_mcs8_2Mbps(3,i)=min(throughput40_100);  
    MHz40_mcs8_2Mbps_Aggr(i)=(sum(packets40_100(i,1:(i*25)))*8*1472/(1024*1024*10));
     %% 80MHz
    clear throughput80_100;
    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_100(j)=dat_80MHz(2*j+1,:);
		through80_100(i,j)=dat_80MHz(2*j+1,:);
        packets80_100(i,j)=dat_80MHz(2*j,:);
    end  
    MHz80_mcs8_2Mbps(1,i)=mean(throughput80_100); 
    MHz80_mcs8_2Mbps(2,i)=max(throughput80_100);  
    MHz80_mcs8_2Mbps(3,i)=min(throughput80_100);  
    MHz80_mcs8_2Mbps_Aggr(i)=(sum(packets80_100(i,1:(i*25)))*8*1472/(1024*1024*10));
     %% 160MHz
    clear throughput160_100;
    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_100(j)=dat_160MHz(2*j+1,:);
		through160_100(i,j)=dat_160MHz(2*j+1,:);
        packets160_100(i,j)=dat_160MHz(2*j,:);
    end  
    MHz160_mcs8_2Mbps(1,i)=mean(throughput160_100); 
    MHz160_mcs8_2Mbps(2,i)=max(throughput160_100);  
    MHz160_mcs8_2Mbps(3,i)=min(throughput160_100);  
    MHz160_mcs8_2Mbps_Aggr(i)=(sum(packets160_100(i,1:(i*25)))*8*1472/(1024*1024*10)); 
end

X_axis = 25:25:150;

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

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

figure('name','Priemerná priepustnos� na klienta: 100% aktívnych, CBR 2Mbit/s','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
leg=legend('kanál 20 MHz','kanál 40 MHz','kanál 80 MHz','kanál 160 MHz','Location','southwest');
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
set(leg,'FontSize',12 );
title('Priemerná priepustnos� na klienta: aktívnych klientov 100%, MCS 8, CBR 2Mbit/s','FontSize',14)
xlabel('Poèet asociovaných klientov','FontSize',14)
ylabel('Priepustnos� [Mbit/s]','FontSize',14)
%% kanál 20 MHz
figure('name','Priemerná priepustnos� na klienta: MCS 8','Position', [50, 50, 1180, 850])
subplot(2,2,1);
plot(X_axis,MHz20_mcs8_2Mbps_50(1,:),'-o','Color',[0.6 0 0.6],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz20_mcs8_2Mbps_70(1,:),'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz20_mcs8_2Mbps(1,:),'-d','Color',[0 0.6 0],'LineWidth',2,'MarkerSize',6); hold on
ylim([0.7 2.2]); grid on
leg=legend('50% aktívnych','70% aktívnych','100% aktívnych','Location','southwest');
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
set(leg,'FontSize',10);
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_mcs8_2Mbps_50(1,:),'-o','Color',[0.6 0 0.6],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs8_2Mbps_70(1,:),'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs8_2Mbps(1,:),'-d','Color',[0 0.6 0],'LineWidth',2,'MarkerSize',6); hold on
ylim([0.7 2.2]);
leg=legend('50% aktívnych','70% aktívnych','100% aktívnych','Location','southwest');
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
set(leg,'FontSize',10);
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_mcs8_2Mbps_50(1,:),'-o','Color',[0.6 0 0.6],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs8_2Mbps_70(1,:),'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs8_2Mbps(1,:),'-d','Color',[0 0.6 0],'LineWidth',2,'MarkerSize',6); hold on
ylim([0.7 2.2]);
leg=legend('50% aktívnych','70% aktívnych','100% aktívnych','Location','southwest'); 
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
set(leg,'FontSize',10);
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_mcs8_2Mbps_50(1,:),'-o','Color',[0.6 0 0.6],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs8_2Mbps_70(1,:),'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs8_2Mbps(1,:),'-d','Color',[0 0.6 0],'LineWidth',2,'MarkerSize',6); hold on
ylim([0.7 2.2]);
leg=legend('50% aktívnych','70% aktívnych','100% aktívnych','Location','southwest');
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
set(leg,'FontSize',10);
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: MCS 8',14) ;

%% Subplots
figure('name','Agregovaná priepustnos�: ','Position', [50, 50, 1180, 850])
%% kanál 20 MHz
subplot(2,2,1);
plot(X_axis,MHz80_mcs8_2Mbps_50_Aggr,'-o','Color',[0.6 0 0.6],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs8_2Mbps_70_Aggr,'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz20_mcs8_2Mbps_Aggr,'-d','Color',[0 0.6 0],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
leg=legend('50% aktívnych','70% aktívnych','100% aktívnych','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_mcs8_2Mbps_50_Aggr,'-o','Color',[0.6 0 0.6],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs8_2Mbps_70_Aggr,'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz40_mcs8_2Mbps_Aggr,'-d','Color',[0 0.6 0],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
leg=legend('50% aktívnych','70% aktívnych','100% aktívnych','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_mcs8_2Mbps_50_Aggr,'-o','Color',[0.6 0 0.6],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs8_2Mbps_70_Aggr,'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz80_mcs8_2Mbps_Aggr,'-d','Color',[0 0.6 0],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
leg=legend('50% aktívnych','70% aktívnych','100% aktívnych','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_mcs8_2Mbps_50_Aggr,'-o','Color',[0.6 0 0.6],'LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs8_2Mbps_70_Aggr,'-v','LineWidth',2,'MarkerSize',6); hold on
plot(X_axis,MHz160_mcs8_2Mbps_Aggr,'-d','Color',[0 0.6 0],'LineWidth',2,'MarkerSize',6); hold on
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
leg=legend('50% aktívnych','70% aktívnych','100% aktívnych','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('Agregovaná priepustnos� [Mbit/s]','FontSize',12)
suptitle('Agregovaná priepustnos�',14) ;

for loop=1:6
    X(loop)=25*loop;
    %%20 MHz kanal
    MHz20_x_50(loop)=max(through20_50(through20_50(loop,:)>-1));
    MHz20_x9_50(loop)=MHz20_x_50(loop)*0.9; MHz20_x10_3(loop)=MHz20_x_50(loop)*0.1;
    MHz20_y10_50(loop)=length(through20_50(through20_50(loop,:)<=MHz20_x10_3(loop)));
    MHz20_y9_50(loop)=length(through20_50(through20_50(loop,:)>MHz20_x9_50(loop)));
        
    MHz20_x_70(loop)=max(through20_70(through20_70(loop,:)>-1));
    MHz20_x9_70(loop)=MHz20_x_70(loop)*0.9; MHz20_x10_5(loop)=MHz20_x_70(loop)*0.1;
    MHz20_y10_70(loop)=length(through20_70(through20_70(loop,:)<=MHz20_x10_5(loop)));
    MHz20_y9_70(loop)=length(through20_70(through20_70(loop,:)>MHz20_x9_70(loop)));
        
    MHz20_x_100(loop)=max(through20_100(through20_100(loop,:)>-1));
    MHz20_x9_100(loop)=MHz20_x_100(loop)*0.9; MHz20_x10_8(loop)=MHz20_x_100(loop)*0.1;
    MHz20_y10_100(loop)=length(through20_100(through20_100(loop,:)<=MHz20_x10_8(loop)));
    MHz20_y9_100(loop)=length(through20_100(through20_100(loop,:)>MHz20_x9_100(loop)));
    
    %%40 MHz kanal
    MHz40_x_50(loop)=max(through40_50(through40_50(loop,:)>-1));
    MHz40_x9_50(loop)=MHz40_x_50(loop)*0.9; MHz40_x10_3(loop)=MHz40_x_50(loop)*0.1;
    MHz40_y10_50(loop)=length(through40_50(through40_50(loop,:)<=MHz40_x10_3(loop)));
    MHz40_y9_50(loop)=length(through40_50(through40_50(loop,:)>MHz40_x9_50(loop)));
        
    MHz40_x_70(loop)=max(through40_70(through40_70(loop,:)>-1));
    MHz40_x9_70(loop)=MHz40_x_70(loop)*0.9; MHz40_x10_5(loop)=MHz40_x_70(loop)*0.1;
    MHz40_y10_70(loop)=length(through40_70(through40_70(loop,:)<=MHz40_x10_5(loop)));
    MHz40_y9_70(loop)=length(through40_70(through40_70(loop,:)>MHz40_x9_70(loop)));
        
    MHz40_x_100(loop)=max(through40_100(through40_100(loop,:)>-1));
    MHz40_x9_100(loop)=MHz40_x_100(loop)*0.9; MHz40_x10_8(loop)=MHz40_x_100(loop)*0.1;
    MHz40_y10_100(loop)=length(through40_100(through40_100(loop,:)<=MHz40_x10_8(loop)));
    MHz40_y9_100(loop)=length(through40_100(through40_100(loop,:)>MHz40_x9_100(loop)));
    
      %%80 MHz kanal
    MHz80_x_50(loop)=max(through80_50(through80_50(loop,:)>-1));
    MHz80_x9_50(loop)=MHz80_x_50(loop)*0.9; MHz80_x10_3(loop)=MHz80_x_50(loop)*0.1;
    MHz80_y10_50(loop)=length(through80_50(through80_50(loop,:)<=MHz80_x10_3(loop)));
    MHz80_y9_50(loop)=length(through80_50(through80_50(loop,:)>MHz80_x9_50(loop)));
        
    MHz80_x_70(loop)=max(through80_70(through80_70(loop,:)>-1));
    MHz80_x9_70(loop)=MHz80_x_70(loop)*0.9; MHz80_x10_5(loop)=MHz80_x_70(loop)*0.1;
    MHz80_y10_70(loop)=length(through80_70(through80_70(loop,:)<=MHz80_x10_5(loop)));
    MHz80_y9_70(loop)=length(through80_70(through80_70(loop,:)>MHz80_x9_70(loop)));
        
    MHz80_x_100(loop)=max(through80_100(through80_100(loop,:)>-1));
    MHz80_x9_100(loop)=MHz80_x_100(loop)*0.9; MHz80_x10_8(loop)=MHz80_x_100(loop)*0.1;
    MHz80_y10_100(loop)=length(through80_100(through80_100(loop,:)<=MHz80_x10_8(loop)));
    MHz80_y9_100(loop)=length(through80_100(through80_100(loop,:)>MHz80_x9_100(loop)));
    
        %%160 MHz kanal
    MHz160_x_50(loop)=max(through160_50(through160_50(loop,:)>-1));
    MHz160_x9_50(loop)=MHz160_x_50(loop)*0.9; MHz160_x10_3(loop)=MHz160_x_50(loop)*0.1;
    MHz160_y10_50(loop)=length(through160_50(through160_50(loop,:)<=MHz160_x10_3(loop)));
    MHz160_y9_50(loop)=length(through160_50(through160_50(loop,:)>MHz160_x9_50(loop)));
        
    MHz160_x_70(loop)=max(through160_70(through160_70(loop,:)>-1));
    MHz160_x9_70(loop)=MHz160_x_70(loop)*0.9; MHz160_x10_5(loop)=MHz160_x_70(loop)*0.1;
    MHz160_y10_70(loop)=length(through160_70(through160_70(loop,:)<=MHz160_x10_5(loop)));
    MHz160_y9_70(loop)=length(through160_70(through160_70(loop,:)>MHz160_x9_70(loop)));
        
    MHz160_x_100(loop)=max(through160_100(through160_100(loop,:)>-1));
    MHz160_x9_100(loop)=MHz160_x_100(loop)*0.9; MHz160_x10_8(loop)=MHz160_x_100(loop)*0.1;
    MHz160_y10_100(loop)=length(through160_100(through160_100(loop,:)<=MHz160_x10_8(loop)));
    MHz160_y9_100(loop)=length(through160_100(through160_100(loop,:)>MHz160_x9_100(loop)));
    
end

figure('name','Normovaná priepustnos�:','Position', [50, 50, 1480, 870])
subplot(2,2,1)
plot(X,MHz20_y10_50./(ceil(X*0.5)).*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0.6 0 0.6])
hold on
plot(X,MHz20_y9_50./(ceil(X*0.5)).*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.6 0 0.6])
hold on
plot(X,MHz20_y10_70./(ceil(X*0.7)).*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0.8500 0.3250 0.0980])
hold on
plot(X,MHz20_y9_70./(ceil(X*0.7)).*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.8500 0.3250 0.0980])
hold on
plot(X,MHz20_y10_100./X.*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0 0.6 0])
hold on
plot(X,MHz20_y9_100./X.*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0 0.6 0])
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
grid on
title('kanál 20 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Poèet klientov [%]','FontSize',12)

subplot(2,2,2)
plot(X,MHz40_y10_50./(ceil(X*0.5)).*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0.6 0 0.6])
hold on
plot(X,MHz40_y9_50./(ceil(X*0.5)).*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.6 0 0.6])
hold on
plot(X,MHz40_y10_70./(ceil(X*0.7)).*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0.8500 0.3250 0.0980])
hold on
plot(X,MHz40_y9_70./(ceil(X*0.7)).*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.8500 0.3250 0.0980])
hold on
plot(X,MHz40_y10_100./X.*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0 0.6 0])
hold on
plot(X,MHz40_y9_100./X.*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0 0.6 0])

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

subplot(2,2,3)
plot(X,MHz80_y10_50./(ceil(X*0.5)).*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0.6 0 0.6])
hold on
plot(X,MHz80_y9_50./(ceil(X*0.5)).*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.6 0 0.6])
hold on
plot(X,MHz80_y10_70./(ceil(X*0.7)).*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0.8500 0.3250 0.0980])
hold on
plot(X,MHz80_y9_70./(ceil(X*0.7)).*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.8500 0.3250 0.0980])
hold on
plot(X,MHz80_y10_100./X.*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0 0.6 0])
hold on
plot(X,MHz80_y9_100./X.*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0 0.6 0])
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
grid on
title('kanál 80 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Poèet klientov [%]','FontSize',12)


subplot(2,2,4)
plot(X,MHz160_y10_50./(ceil(X*0.5)).*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0.6 0 0.6])
hold on
plot(X,MHz160_y9_50./(ceil(X*0.5)).*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.6 0 0.6])
hold on
plot(X,MHz160_y10_70./(ceil(X*0.7)).*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0.8500 0.3250 0.0980])
hold on
plot(X,MHz160_y9_70./(ceil(X*0.7)).*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0.8500 0.3250 0.0980])
hold on
plot(X,MHz160_y10_100./X.*100,':x','MarkerSize',8,'LineWidth',2,'Color',[0 0.6 0])
hold on
plot(X,MHz160_y9_100./X.*100,'--s','MarkerSize',8,'LineWidth',2,'Color',[0 0.6 0])
set(gca,'XTick',[25 50 75 100 125 150],'FontSize',12); grid on
grid on
title('kanál 160 MHz','FontSize',12,'FontWeight','normal')
xlabel('Poèet asociovaných klientov','FontSize',12)
ylabel('Poèet klientov [%]','FontSize',12)
legend('P_k < 10% P_{kMAX},  50% aktív','P_k > 90% P_{kMAX},  50% aktív',...
       'P_k < 10% P_{kMAX},  70% aktív','P_k > 90% P_{kMAX},  70% aktív',...
       'P_k < 10% P_{kMAX}, 100% aktív','P_k > 90% P_{kMAX}, 100% aktív','Location','west')
