close all;
clear all;



%% NSA

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

% %% NSA - Horizontal

freq1 = xlsread(filename, sheet, 'A3:A19');
freq2 = xlsread(filename, sheet, 'A21:A28');

HHC1  = xlsread(filename, sheet, 'C3:C19');
HHR1  = xlsread(filename, sheet, 'D3:D19');
HHL1  = xlsread(filename, sheet, 'E3:E19');
HHF1  = xlsread(filename, sheet, 'F3:F19');
HHB1  = xlsread(filename, sheet, 'G3:G19');

HLC1  = xlsread(filename, sheet, 'I3:I19');
HLR1  = xlsread(filename, sheet, 'J3:J19');
HLL1  = xlsread(filename, sheet, 'K3:K19');
HLF1  = xlsread(filename, sheet, 'L3:L19');
HLB1  = xlsread(filename, sheet, 'M3:M19');

HHC2  = xlsread(filename, sheet, 'C21:C28');
HHR2  = xlsread(filename, sheet, 'D21:D28');
HHL2  = xlsread(filename, sheet, 'E21:E28');
HHF2  = xlsread(filename, sheet, 'F21:F28');
HHB2  = xlsread(filename, sheet, 'G21:G28');

HLC2  = xlsread(filename, sheet, 'I21:I28');
HLR2  = xlsread(filename, sheet, 'J21:J28');
HLL2  = xlsread(filename, sheet, 'K21:K28');
HLF2  = xlsread(filename, sheet, 'L21:L28');
HLB2  = xlsread(filename, sheet, 'M21:M28');

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

subplot(2,1,1)
plot(freq1, HHC1, 'b','LineWidth',2)
hold on;
plot(freq1, HHR1, 'g','LineWidth',2)
hold on;
plot(freq1, HHL1, 'r','LineWidth',2)
hold on;
plot(freq1, HHF1, 'c','LineWidth',2)
hold on;
plot(freq1, HHB1, 'm','LineWidth',2)
hold on;

plot(freq1, HLC1, '--b','LineWidth',2)
hold on;
plot(freq1, HLR1, '--g','LineWidth',2)
hold on;
plot(freq1, HLL1, '--r','LineWidth',2)
hold on;
plot(freq1, HLF1, '--c','LineWidth',2)
hold on;
plot(freq1, HLB1, '--m','LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('NSA - horizontální polarizace ');
legend( 'HHC', 'HHR', 'HHL', 'HHF', 'HHB', 'HLC', 'HLR', 'HLL', 'HLF', 'HLB','Location','south','Orientation','horizontal')
xlabel('Frekvence [MHz]');
ylabel('Odchylka [dB]');
ylim([-4 4])
set(gca,'FontSize',20)

subplot(2,1,2)
plot(freq2, HHC2, 'b','LineWidth',2)
hold on;
plot(freq2, HHR2, 'g','LineWidth',2)
hold on;
plot(freq2, HHL2, 'r','LineWidth',2)
hold on;
plot(freq2, HHF2, 'c','LineWidth',2)
hold on;
plot(freq2, HHB2, 'm','LineWidth',2)
hold on;

plot(freq2, HLC2, '--b','LineWidth',2)
hold on;
plot(freq2, HLR2, '--g','LineWidth',2)
hold on;
plot(freq2, HLL2, '--r','LineWidth',2)
hold on;
plot(freq2, HLF2, '--c','LineWidth',2)
hold on;
plot(freq2, HLB2, '--m','LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('NSA - horizontální polarizace ');
legend( 'HHC', 'HHR', 'HHL', 'HHF', 'HHB', 'HLC', 'HLR', 'HLL', 'HLF', 'HLB','Location','south','Orientation','horizontal')
xlabel('Frekvence [MHz]');
ylabel('Odchylka [dB]');
ylim([-4 4])
set(gca,'FontSize',20)

%% NSA - Vertical

LHC1  = xlsread(filename, sheet, 'O3:O19');
LHR1  = xlsread(filename, sheet, 'P3:P19');
LHL1  = xlsread(filename, sheet, 'Q3:Q19');
LHF1  = xlsread(filename, sheet, 'R3:R19');
LHB1  = xlsread(filename, sheet, 'S3:S19');

LLC1  = xlsread(filename, sheet, 'U3:U19');
LLR1  = xlsread(filename, sheet, 'V3:V19');
LLL1  = xlsread(filename, sheet, 'W3:W19');
LLF1  = xlsread(filename, sheet, 'X3:X19');
LLB1  = xlsread(filename, sheet, 'Y3:Y19');

LHC2  = xlsread(filename, sheet, 'O21:O28');
LHR2  = xlsread(filename, sheet, 'P21:P28');
LHL2  = xlsread(filename, sheet, 'Q21:Q28');
LHF2  = xlsread(filename, sheet, 'R21:R28');
LHB2  = xlsread(filename, sheet, 'S21:S28');

LLC2  = xlsread(filename, sheet, 'U21:U28');
LLR2  = xlsread(filename, sheet, 'V21:V28');
LLL2  = xlsread(filename, sheet, 'W21:W28');
LLF2  = xlsread(filename, sheet, 'X21:X28');
LLB2  = xlsread(filename, sheet, 'Y21:Y28');

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

subplot(2,1,1)
plot(freq1, LHC1, 'b','LineWidth',2)
hold on;
plot(freq1, LHR1, 'g','LineWidth',2)
hold on;
plot(freq1, LHL1, 'r','LineWidth',2)
hold on;
plot(freq1, LHF1, 'c','LineWidth',2)
hold on;
plot(freq1, LHB1, 'm','LineWidth',2)
hold on;

plot(freq1, LLC1, '--b','LineWidth',2)
hold on;
plot(freq1, LLR1, '--g','LineWidth',2)
hold on;
plot(freq1, LLL1, '--r','LineWidth',2)
hold on;
plot(freq1, LLF1, '--c','LineWidth',2)
hold on;
plot(freq1, LLB1, '--m','LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('NSA - vertikální polarizace ');
legend( 'HHC', 'HHR', 'HHL', 'HHF', 'HHB', 'HLC', 'HLR', 'HLL', 'HLF', 'HLB','Location','south','Orientation','horizontal')
xlabel('Frekvence [MHz]');
ylabel('Odchylka [dB]');
ylim([-4 4])
set(gca,'FontSize',20)

subplot(2,1,2)
plot(freq2, LHC2, 'b','LineWidth',2)
hold on;
plot(freq2, LHR2, 'g','LineWidth',2)
hold on;
plot(freq2, LHL2, 'r','LineWidth',2)
hold on;
plot(freq2, LHF2, 'c','LineWidth',2)
hold on;
plot(freq2, LHB2, 'm','LineWidth',2)
hold on;

plot(freq2, LLC2, '--b','LineWidth',2)
hold on;
plot(freq2, LLR2, '--g','LineWidth',2)
hold on;
plot(freq2, LLL2, '--r','LineWidth',2)
hold on;
plot(freq2, LLF2, '--c','LineWidth',2)
hold on;
plot(freq2, LLB2, '--m','LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('NSA - vertikální polarizace ');
legend( 'HHC', 'HHR', 'HHL', 'HHF', 'HHB', 'HLC', 'HLR', 'HLL', 'HLF', 'HLB','Location','south','Orientation','horizontal')
xlabel('Frekvence [MHz]');
ylabel('Odchylka [dB]');
ylim([-4 4])
set(gca,'FontSize',20)

%% VSWR - FAR, HOR

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

freq1 = xlsread(filename, sheet, 'A4:A74');
freq2 = xlsread(filename, sheet, 'A74:A134 ');

FHC1  = xlsread(filename, sheet, 'C4:C74');
FHF1  = xlsread(filename, sheet, 'D4:D74');
FHL1  = xlsread(filename, sheet, 'E4:E74');
FHR1  = xlsread(filename, sheet, 'F4:F74');
FHT1  = xlsread(filename, sheet, 'G4:G74');

FHC2  = xlsread(filename, sheet, 'C74:C134');
FHF2  = xlsread(filename, sheet, 'D74:D134');
FHL2  = xlsread(filename, sheet, 'E74:E134');
FHR2  = xlsread(filename, sheet, 'F74:F134');
FHT2  = xlsread(filename, sheet, 'G74:G134');

%% VSWR - FAR, VER

FVC1  = xlsread(filename, sheet, 'I4:I74');
FVF1  = xlsread(filename, sheet, 'J4:J74');
FVL1  = xlsread(filename, sheet, 'K4:K74');
FVR1  = xlsread(filename, sheet, 'L4:L74');
FVT1  = xlsread(filename, sheet, 'M4:M74');

FVC2  = xlsread(filename, sheet, 'I74:I134');
FVF2  = xlsread(filename, sheet, 'J74:J134');
FVL2  = xlsread(filename, sheet, 'K74:K134');
FVR2  = xlsread(filename, sheet, 'L74:L134');
FVT2  = xlsread(filename, sheet, 'M74:M134');

%% VSWR - SAR, HOR

SHC1  = xlsread(filename, sheet, 'O4:O74');
SHF1  = xlsread(filename, sheet, 'P4:P74');
SHL1  = xlsread(filename, sheet, 'Q4:Q74');
SHR1  = xlsread(filename, sheet, 'R4:R74');
SHT1  = xlsread(filename, sheet, 'S4:S74');

SHC2  = xlsread(filename, sheet, 'O74:O134');
SHF2  = xlsread(filename, sheet, 'P74:P134');
SHL2  = xlsread(filename, sheet, 'Q74:Q134');
SHR2  = xlsread(filename, sheet, 'R74:R134');
SHT2  = xlsread(filename, sheet, 'S74:S134');

%% VSWR - SAR, VER

SVC1  = xlsread(filename, sheet, 'U4:U74');
SVF1  = xlsread(filename, sheet, 'V4:V74');
SVL1  = xlsread(filename, sheet, 'W4:W74');
SVR1  = xlsread(filename, sheet, 'X4:X74');
SVT1  = xlsread(filename, sheet, 'Y4:Y74');

SVC2  = xlsread(filename, sheet, 'U74:U134');
SVF2  = xlsread(filename, sheet, 'V74:V134');
SVL2  = xlsread(filename, sheet, 'W74:W134');
SVR2  = xlsread(filename, sheet, 'X74:X134');
SVT2  = xlsread(filename, sheet, 'Y74:Y134');

%% Results 

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

subplot(2,1,1)
plot(freq1, FHC1, 'b','LineWidth',2)
hold on;
plot(freq1, FHF1, 'g','LineWidth',2)
hold on;
plot(freq1, FHL1, 'r','LineWidth',2)
hold on;
plot(freq1, FHR1, 'c','LineWidth',2)
hold on;
plot(freq1, FHT1, 'm','LineWidth',2)
hold on;


set(gca,'FontSize',25)
title('VSWR - horizontální polarizace (FAR) ');
legend( 'HC', 'HF', 'HL', 'HR', 'HT', 'Location','northeast','Orientation','vertical')
xlabel('Frekvence [GHz]');
ylabel('Odchylka [dB]');
ylim([0 6])
set(gca,'FontSize',20)

subplot(2,1,2)

plot(freq2, FHC2, 'b','LineWidth',2)
hold on;
plot(freq2, FHF2, 'g','LineWidth',2)
hold on;
plot(freq2, FHL2, 'r','LineWidth',2)
hold on;
plot(freq2, FHR2, 'c','LineWidth',2)
hold on;
plot(freq2, FHT2, 'm','LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('VSWR - horizontální polarizace (FAR)');
legend( 'HC', 'HF', 'HL', 'HR', 'HT', 'Location','northeast','Orientation','vertical')
xlabel('Frekvence [GHz]');
ylabel('Odchylka [dB]');
ylim([0 6])
set(gca,'FontSize',20)

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

subplot(2,1,1)
plot(freq1, FVC1, 'b','LineWidth',2)
hold on;
plot(freq1, FVF1, 'g','LineWidth',2)
hold on;
plot(freq1, FVL1, 'r','LineWidth',2)
hold on;
plot(freq1, FVR1, 'c','LineWidth',2)
hold on;
plot(freq1, FVT1, 'm','LineWidth',2)
hold on;


set(gca,'FontSize',25)
title('VSWR - vertikální polarizace (FAR) ');
legend( 'VC', 'VF', 'VL', 'VR', 'VT', 'Location','northeast','Orientation','vertical')
xlabel('Frekvence [GHz]');
ylabel('Odchylka [dB]');
ylim([0 6])
set(gca,'FontSize',20)

subplot(2,1,2)

plot(freq2, FVC2, 'b','LineWidth',2)
hold on;
plot(freq2, FVF2, 'g','LineWidth',2)
hold on;
plot(freq2, FVL2, 'r','LineWidth',2)
hold on;
plot(freq2, FVR2, 'c','LineWidth',2)
hold on;
plot(freq2, FVT2, 'm','LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('VSWR - vertikální polarizace (FAR)');
legend( 'VC', 'VF', 'VL', 'VR', 'VT', 'Location','northeast','Orientation','vertical')
xlabel('Frekvence [GHz]');
ylabel('Odchylka [dB]');
ylim([0 6])
set(gca,'FontSize',20)

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

subplot(2,1,1)
plot(freq1, SHC1, 'b','LineWidth',2)
hold on;
plot(freq1, SHF1, 'g','LineWidth',2)
hold on;
plot(freq1, SHL1, 'r','LineWidth',2)
hold on;
plot(freq1, SHR1, 'c','LineWidth',2)
hold on;
plot(freq1, SHT1, 'm','LineWidth',2)
hold on;


set(gca,'FontSize',25)
title('VSWR - horizontální polarizace (SAR) ');
legend( 'HC', 'HF', 'HL', 'HR', 'HT', 'Location','northeast','Orientation','vertical')
xlabel('Frekvence [GHz]');
ylabel('Odchylka [dB]');
ylim([0 6])
set(gca,'FontSize',20)

subplot(2,1,2)

plot(freq2, SHC2, 'b','LineWidth',2)
hold on;
plot(freq2, SHF2, 'g','LineWidth',2)
hold on;
plot(freq2, SHL2, 'r','LineWidth',2)
hold on;
plot(freq2, SHR2, 'c','LineWidth',2)
hold on;
plot(freq2, SHT2, 'm','LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('VSWR - horizontální polarizace (SAR)');
legend( 'HC', 'HF', 'HL', 'HR', 'HT', 'Location','northeast','Orientation','vertical')
xlabel('Frekvence [GHz]');
ylabel('Odchylka [dB]');
ylim([0 6])
set(gca,'FontSize',20)

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

subplot(2,1,1)
plot(freq1, SVC1, 'b','LineWidth',2)
hold on;
plot(freq1, SVF1, 'g','LineWidth',2)
hold on;
plot(freq1, SVL1, 'r','LineWidth',2)
hold on;
plot(freq1, SVR1, 'c','LineWidth',2)
hold on;
plot(freq1, SVT1, 'm','LineWidth',2)
hold on;


set(gca,'FontSize',25)
title('VSWR - vertikální polarizace (SAR) ');
legend( 'VC', 'VF', 'VL', 'VR', 'VT', 'Location','northeast','Orientation','vertical')
xlabel('Frekvence [GHz]');
ylabel('Odchylka [dB]');
ylim([0 6])
set(gca,'FontSize',20)

subplot(2,1,2)

plot(freq2, SVC2, 'b','LineWidth',2)
hold on;
plot(freq2, SVF2, 'g','LineWidth',2)
hold on;
plot(freq2, SVL2, 'r','LineWidth',2)
hold on;
plot(freq2, SVR2, 'c','LineWidth',2)
hold on;
plot(freq2, SVT2, 'm','LineWidth',2)
hold on;

set(gca,'FontSize',25)
title('VSWR - vertikální polarizace (SAR)');
legend( 'VC', 'VF', 'VL', 'VR', 'VT', 'Location','northeast','Orientation','vertical')
xlabel('Frekvence [GHz]');
ylabel('Odchylka [dB]');
ylim([0 6])
set(gca,'FontSize',20)

%% vyhlazeni

% 
%  
%  O = 1;
% for Q = 1:1:24
%     for i = 1:1:10
%         VER_25X(O) = VER_25(Q);
%         freqX(0) = (0.1*(i-1)*(freq(Q+1)-freq(Q)) + freq(Q)
%         O = O+1;
%     end
% end
% 
%   W = window(@hann, 5);
%   WW = window(@hann, 10);
%   WWW = window(@hann, 15);
%   
%    R = filtfilt(W, 2, VER_25X)
%     RR = filtfilt(WW, 4.5, VER_25X)
%      RRR = filtfilt(WWW, 7, VER_25X)
%      
%      
%      figure(5)
%      plot(R)
%      hold on;
%      plot(RR);
%      hold on;
%      plot(RRR)
% 
%  
 
 
 
 