%**************************************************************************
%This function plots the field integral as a function of position.
%
%Input:
%plt_file, plot file for results
%plt_title, title for plot
%gap, undulator gap (m)
%integ_ave, average of field integral at each position (Tm or Tm^2)
%integ_rms, rms variation of field integral at each position (Tm or Tm^2)
%
%Zachary Wolf, 9/5/08

function [] = long_coil_plot_i2vsgap(plt_file, plt_title, gap, integ_ave, integ_rms)

%Plot the data
figure;
hold on;
plot(gap * 1.e3, integ_ave * 1.e6, 'b-', 'linewidth', .5);
errorbar(gap * 1.e3, integ_ave * 1.e6, integ_rms * 1.e6, 'ro', 'linewidth', .5, 'markeredgecolor', 'r', 'markerfacecolor', 'r');
xlim([0, 200]);
ylim([-200, 200]);
title(plt_title);
xlabel('Gap (mm)');
ylabel('Second Integral (\muTm**2)');
grid on;
zoom on;
hold off;
util_print_fig(plt_file);

%Done
