% Linmot Shield Test Analysis for By 15 A motor setup.
%  Finds the max and min of the voltage sample data and then computes the
%  field change for each z point.  Calibration is 1V = 1mT
 
z_positions = -140:20:140;

% Get By data

By_15A = zeros(1, length(z_positions));
sigBy = zeros(1, length(z_positions));

for i=1:length(z_positions)
   
   Vy1(i) = Load_testplt(i);
   By_15A(i) = 10*(max(Vy1(i).Vsamp) - min(Vy1(i).Vsamp));  % Units are now Gauss.  1mT = 10 G
  
end
figure
plot_bars(z_positions, By_15A, sigBy, 'bo');
xlabel('Z (mm)');
ylabel('By (G)');
title('FWS By field during upward movement with 15 A motor Power Supply');
saveas(gcf,'By field 15 A no bottom shield.png')


By_integral_15A = integrate(By_15A, 2) % G-cm units, step size = 2 cm
