%GHOST sled measurement at RAC tent on November 28, 2023

%% Fuselage H
figure(1); clf;
h_plot = [];
legend_strs = {};
ant = 1:16;
for ant_idx = 1:length(ant)
  fn = sprintf('COLDEX_FUSELAGE_%dH.s1p',ant(ant_idx));
  [freq, data] = SXPParse(fn);
  S11 = squeeze(data(1,1,:));
  legend_strs{ant_idx} = sprintf('ANT %dH',ant(ant_idx));

  h_plot(ant_idx) = plot(freq/1e6,lp(S11));
  hold on;

  grid on;
  xlabel('Frequency (MHz)')
  ylabel('Return loss (dB)')
end
legend(h_plot, legend_strs, 'location', 'best')
xlim([500 1000]);

%% Fuselage V
figure(2); clf;
h_plot = [];
legend_strs = {};
ant = [1:4 13:16];
for ant_idx = 1:length(ant)
  fn = sprintf('COLDEX_FUSELAGE_%dV.s1p',ant(ant_idx));
  [freq, data] = SXPParse(fn);
  S11 = squeeze(data(1,1,:));
  legend_strs{ant_idx} = sprintf('ANT %dV',ant(ant_idx));

  h_plot(ant_idx) = plot(freq/1e6,lp(S11));
  hold on;

  grid on;
  xlabel('Frequency (MHz)')
  ylabel('Return loss (dB)')
end
legend(h_plot, legend_strs, 'location', 'best')
xlim([500 1000]);

%% Wing H
figure(3); clf;
h_plot = [];
legend_strs = {};
ant = [1:6];
for ant_idx = 1:length(ant)
  fn = sprintf('COLDEX_WING_ANT%d.s1p',ant(ant_idx));
  [freq, data] = SXPParse(fn);
  S11 = squeeze(data(1,1,:));
  legend_strs{ant_idx} = sprintf('ANT %dW',ant(ant_idx));

  h_plot(ant_idx) = plot(freq/1e6,lp(S11));
  hold on;

  grid on;
  xlabel('Frequency (MHz)')
  ylabel('Return loss (dB)')
end
legend(h_plot, legend_strs, 'location', 'best')
xlim([500 1000]);
