% Measured I,Q power spectrum for the relevant DRMI REFLAIR RFPDS
% Injected a 3.25Hz sine wave in PRM_M3_LOCK_L_EXC w/ amplitude of 10000

power = [10; 1; 5; 7]; % in Watts
I45 = [-48; -68.6; -54.6; -51.7]; % in dB at -135 deg
Q45 = [-54.8; -82.4; -69; -69];

I9 = [-54.5; -74.6; -61; -57.8];  % in dB at 93 deg
Q9 = [-89.2; -98.2; -85; -82.3];

I27 = [-42; -62; -49; -45.6];  % in dB at 107.8 deg
Q27 = [-51;-83.7;-59;-54.4];

I135 = [-35; -60.9;-56; -45.7];  % in dB at -30 deg
Q135 = [-37;-66.1;-49;-41.8];

polyfitI45 = polyfit(power, I45,1);
polyfitI9 = polyfit(power, I9,1);


figure(1);
clf;
h=plot(power,I45,'o',...
     power, Q45,'o',...
     power, I9,'o',...
     power, Q9,'o',...
     power, I27,'o',...
     power, Q27,'o',...
     power, I135,'*',...
     power, Q135,'*');
 grid on;
 legend('I45','Q45','I9','Q9','I27','Q27','I135','Q135','Location','NorthEastOutside');
 set(h,'LineWidth',3);
 
 figure(2);
 clf;
 hh=plot(power,I45, 'bo',...
      power, polyfitI45(2) + polyfitI45(1)*power,'b',...
      power,I9, 'go',...
      power, polyfitI9(2) + polyfitI9(1)*power,'g');
 grid on;
 legend('I45','I45 lin fit','I9','I9 lin fit');
 set(hh,'LineWidth',3);

  