% filename: plots_Icenter_devs_v1b.m
% Script plots the results of the Modular Coil Current Center
% Deviation Comparison.

%{
Created by Mark Smith
Princeton Plasma Physics Laboratory 
James Forrestal Campus 
P.O. Box 451 
Princeton, NJ 08543-0451 

Created 1/08/08
..........................................................................
Validate Winding Coil Deviations Notes:
Two to three script files form the overall algorithm to create one excel file 
from the multiple Roamer Arm PowerInspect reports developed during the winding 
coil process. After this file is created, it is used to re-calculate the current 
center deviations.
Use this script file after the current center deviations and comparison have 
been computed. This code plots the results.
...........................................................................
Algorithm plots_Icenter_devs_v1b.m notes:
The data/results reflect a ProE default coordinate system. 
The current center deviations dx (lateral to the septum) and dy (radial to the septum)
are determined at each clamp location. The deviations are calculated via averaging.
For example, each base data set consists of 4 measurments which are averaged
yielding 1 base value for this clamp location. After averaging at each clamp
location, there are 8 values representing the coil geometry (base,septum,top,side)
each for measurments sdies A and B. The current center is the center of 
Area for this cross-section which is computed via averaging of the 8 geometry
values. NOTE: side A septum and side values must be multipled -1 to account 
for sign convention. 
The current center deviations computed are then compared to Art Brooks' results. 
..........................................................................
Script notes: plots_Icenter_devs_v1b.m
This code is used for B coils only.

INPUTS:
mat file/variable: validation_summary
validation_summary columns are: 
sequence#, dx, (art's dx), dy, (art's dy), diff(col 2&3),diff(col 4&5),RSumSq

OUTPUTS:
Comparison Plots.
Units are in inches.
%}

% ************************************************************************
% Print Results
% ************************************************************************

figure('Name','Validation of Current Center Deviations: B2')
% Display for comparison of lateral (dx) values.
subplot(2,2,1)
plot(validation_summary(:,3),'k')   % Plot Art's dx.
hold on
plot(validation_summary(:,2),'--r')
axis([1 96 min(validation_summary(:,3)) max(validation_summary(:,3))])
hold off
set(gca,'fontsize',8)
title('Lateral Deviations: dx','fontsize',8);
xlabel('Clamp #','fontsize',8);
ylabel('inches','fontsize',8);
legend('AB','MS')

% Display for comparison of radial (dy) values.
subplot(2,2,2)
plot(validation_summary(:,5),'k')   % Plot Art's dy.
hold on
plot(validation_summary(:,4),'--r')
axis([1 96 min(validation_summary(:,5)) max(validation_summary(:,5))])
hold off
set(gca,'fontsize',8)
title('Radial Deviations: dy','fontsize',8);
xlabel('Clamp #','fontsize',8);
ylabel('inches','fontsize',8);
legend('AB','MS')

% Display difference between methods.
subplot(2,2,3:4)
plot(validation_summary(:,6),'b')
hold on
plot(validation_summary(:,7),'--g')
axis([1 96 min(validation_summary(:,7)) max(validation_summary(:,7))])
hold off
set(gca,'fontsize',8)
title('Difference Bewtween Methods','fontsize',8);
xlabel('Clamp #','fontsize',8);
ylabel('inches','fontsize',8);
legend('delta(dx)','delta(dy)','Location','best')

