%% Field Uniformity 
clear all;
close     all;


filename = 'matlab_data.xlsx';
sheet = 8;

%% FU - Horizontal

Xplot = xlsread(filename, sheet, 'B1:BJ1');


VER_30 = xlsread(filename, sheet, 'B2:BJ2');
VER_500 = xlsread(filename, sheet, 'B3:BJ3');
VER_1000 = xlsread(filename, sheet, 'B4:BJ4');

HOR_30 = xlsread(filename, sheet, 'B8:BJ8');
HOR_500 = xlsread(filename, sheet, 'B9:BJ9');
HOR_1000 = xlsread(filename, sheet, 'B10:BJ10');

 O = 1;
for Q = 1:1:length(Xplot)
      for i = 1:1:3
        Xplots(O) = Xplot(Q);
        
        VER_30s(O) = VER_30(Q);
        VER_500s(O) = VER_500(Q);
        VER_1000s(O) = VER_1000(Q);

        HOR_30s(O) = HOR_30(Q);
        HOR_500s(O) = HOR_500(Q);
        HOR_1000s(O) = HOR_1000(Q);                     
            
       O = O+1;
    end
end
   W = window(@hann, 10);
   Xplotn = filtfilt(W, 4.5, Xplots);
   
   VER_30n = filtfilt(W, 4.5, VER_30s);
   VER_500n = filtfilt(W, 4.5, VER_500s);
   VER_1000n = filtfilt(W, 4.5, VER_1000s);
   
   HOR_30n = filtfilt(W, 4.5, HOR_30s);
   HOR_500n = filtfilt(W, 4.5, HOR_500s);
   HOR_1000n = filtfilt(W, 4.5, HOR_1000s);
 
%%
figure(1)
set(gcf, 'color', [1 1 1])

subplot(2,1,1)
plot(Xplot, VER_30, 'g', 'LineWidth',2)
hold on;
plot(Xplot, VER_500, 'r', 'LineWidth',2)
hold on;
plot(Xplot, VER_1000, 'b', 'LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('Vertikální polarizace');
legend( '30 MHz', '500 MHz', '1000 MHz', 'Location','northeast','Orientation','vertical')
xlabel('Výška antény [m]');
ylabel('Intenzita [dB\muV/m]');
xlim([1 4]);
%ylim([30 130]);
set(gca,'FontSize',20)

subplot(2,1,2)
plot(Xplot, HOR_30, 'g', 'LineWidth',2)
hold on;
plot(Xplot, HOR_500, 'r','LineWidth',2)
hold on;
plot(Xplot, HOR_1000, 'b', 'LineWidth',2)
hold on;
set(gca,'FontSize',25)
title('Horizontální polarizace');
legend( '30 MHz', '500 MHz', '1000 MHz', 'Location','northeast','Orientation','vertical')
xlabel('Výška antény [m]');
ylabel('Intenzita [dB\muV/m]');
xlim([1 4]);
%ylim([5 30]);
set(gca,'FontSize',20)

%%

figure(2)
set(gcf, 'color', [1 1 1])

subplot(2,1,1)
plot(Xplotn, VER_30n, 'g', 'LineWidth',2)
hold on;
plot(Xplotn, VER_500n, 'r', 'LineWidth',2)
hold on;
plot(Xplotn, VER_1000n, 'b', 'LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('Vertikální polarizace');
legend( '30 MHz', '500 MHz', '1000 MHz', 'Location','northeast','Orientation','vertical')
xlabel('Výška antény [m]');
ylabel('Intenzita [dB\muV/m]');
xlim([1 4]);
%ylim([30 130]);
set(gca,'FontSize',20)

subplot(2,1,2)
plot(Xplotn, HOR_30n, 'g', 'LineWidth',2)
hold on;
plot(Xplotn, HOR_500n, 'r','LineWidth',2)
hold on;
plot(Xplotn, HOR_1000n, 'b', 'LineWidth',2)
hold on;
set(gca,'FontSize',25)
title('Horizontální polarizace');
legend( '30 MHz', '500 MHz', '1000 MHz', 'Location','northeast','Orientation','vertical')
xlabel('Výška antény [m]');
ylabel('Intenzita [dB\muV/m]');
xlim([1 4]);
%ylim([5 30]);
set(gca,'FontSize',20)