% Linmot Shield Test Analysis for Bx 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 Bx data

Bx_15A = zeros(1, length(z_positions));
sigBx = zeros(1, length(z_positions));

for i=1:length(z_positions)
   
   Vx1 = Load_testplt(i);
   Bx_15A(i) = 10*(max(Vx1.Vsamp) - min(Vx1.Vsamp));  % Units are now Gauss.  3mT = 3V, so 1mT/V = 10 G/V
end
figure
plot_bars(z_positions, Bx_15A, sigBx, 'bo');
xlabel('Z (mm)');
ylabel('Bx (G)');
title('Linmot Bx field during upward movement with 15 A motor Power Supply');
saveas(gcf,'Bx field 15 A no bottom shield.png')


Bx_integral_15A = integrate(Bx_15A, 2) % G-cm units when dx is 2 cm
