%**************************************************************************
%This function plots the field integrals.
%The filtered integrals are also plotted.
%
%Input:
%plt_file, plot file for results
%z, position along the undulator (m)
%by, field value (T)
%by_filt, filtered field value (T) 
%int_by_dz, first integral of field (Tm)
%int_by_dz_filt, filtered first integral of field (Tm) 
%int_int_by_dz_dz, second integral of field (Tm^2)
%int_int_by_dz_dz_filt, filtered second integral of field (Tm^2) 
%
%Zachary Wolf, 6/22/10

function [] = int_plot_by_int(plt_file, z, by, by_filt, int_by_dz, int_by_dz_filt, int_int_by_dz_dz, int_int_by_dz_dz_filt)
    
%Plot the field
figure;
subplot(3, 1, 1);
hold on;
plot(z, by, 'linewidth', 0.25);
title('By Field Integrals');
%title('By vs Z');
ylabel('By (T)');
grid on;
zoom on;

%Plot the lambda filtered field
plot(z, by_filt, 'linewidth', 3.);
hold off;

%Plot the first field integral
subplot(3, 1, 2);
hold on;
plot(z, int_by_dz, 'linewidth', 0.25);
%title('\int By dz vs Z');
ylabel('\int By dz (Tm)');
grid on;
zoom on;

%Plot the lambda filtered first integral
plot(z, int_by_dz_filt, 'linewidth', 3.);
hold off;

%Plot the second field integral
subplot(3, 1, 3);
hold on;
plot(z, int_int_by_dz_dz, 'linewidth', 0.25);
%title('\int \int By dz dz vs Z');
ylabel('\int \int By dz dz (Tm^2)');
xlabel('Z (m)');
grid on;
zoom on;

%Plot the lambda filtered second integral
plot(z, int_int_by_dz_dz_filt, 'linewidth', 3.);
hold off;

%Print
util_print_fig(plt_file);

%Done
