%
%  This file processes the data from the first trial
%
function data = process_data_2carts;
%
%  enter the data as 
%       frequency        input (in cm)    output amplitude (in cm) for X1 X2; 
%
%  such as 
%
%  measured = [1.0 0.150 1.740 1.000;
%              1.5 0.150 2.300 1.200;
%              2.0 0.50 1.100  0.900];
%

  measured = [ 0.5 0.02 0.3843 0.2534;
               1.0 0.02 0.6264 0.4362;
               1.3 0.02 1.1439 0.8142;
               1.4 0.02 1.5672 1.1305;
               1.5 0.02 2.3793 1.7498;
               1.6 0.02 2.9599 2.1892;
               1.7 0.01 0.5945 0.4381;
               2.0 0.02 0.8017 0.6184;
               2.5 0.02 0.3199 0.2753;
               3.0 0.02 0.1850 0.1805;
               3.5 0.04 0.2517 0.2928;
               4.0 0.04 0.1535 0.2453;
               4.5 0.04 0.1020 0.2350;
               5.0 0.04 0.0423 0.2764;
               5.5 0.04 0.0731 0.4219;
               6.0 0.04 0.3639 0.6796;
               6.5 0.04 0.1667 0.2089;
               7.0 0.04 0.1100 0.0997;
               7.5 0.04 0.0831 0.0574];
%
%  Be sure the rows are sorted by frequency
%
   measured = sortrows(measured,1);
%
%  get the magnitude of the transfer function
%
  H1 = measured(:,3)./measured(:,2);
  H2 = measured(:,4)./measured(:,2);
  f = measured(:,1); 
  data = [f H1 H2];
%
  return;