%% Load Data
clear; clf; hold off;
angle = [-30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 110 120];

coin4m = [-26.9 -15.9 -5 5.8 16.5 27 37.4 47.5 57.6 67.4 77.1 86.7 96.2 105.5 114.8 124];
coin3p5m = [-26.4 -15.3 -4.2 6.7 17.4 28 38.4 48.6 58.6 68.4 78 87.5 96.9 106.2 115.4 124.5];
coin3m = [-27.8 -14.4 -3.3 7.8 18.65 29.3 39.7 49.9 59.8 69.6 79.2 88.6 97.9 107.1 116.1 125.1];
coin2p5m = [-24.9 -13.3 -1.9 9.4 20.4 31.1 41.5 51.7 61.6 71.3 80.8 90.1 99.2 108.2 117.1 125.9];
coin2m = [-23.5 -11.5 0.2 11.7 22.9 33.7 44.2 54.3 64.1 73.7 83 92.1 101 109.8 118.5 127.1];

plot(angle, coin4m, angle, coin3p5m, angle, coin3m, angle, coin2p5m,...
    angle,coin2m);
legend('h=4m','h=3.5m','h=3m','h=2.5m','h=2m','Location','southeast');
xlabel('Frame Angle (Degrees)')
ylabel('Coincident Strobe Angle (Degrees)');
title('Coincident Center Lighting on OI Sled with Strobe Arms');

export_fig('CoincidentCenterLighting_FullRange.pdf');

xlim([-20, 60]);

export_fig('CoincidentCenterLighting_ActualRange.pdf');

m = polyfit(angle, coin3m, 1);
fitdata = polyval(m,angle);

act_angle = angle(2:10);
act_coin3m = coin3m(2:10);
m2 = polyfit(act_angle, act_coin3m,1);
act_fit = polyval(m2,act_angle);

plot(angle,coin3m,'*',angle, fitdata,act_angle,act_fit,'LineWidth',2);
legend('h=3m','fit @ 3m for entire range of motion','fit @ 3m for restricted range of motion','Location','southeast');
xlabel('Frame Angle (Degrees)')
ylabel('Coincident Strobe Angle (Degrees)');
title('Coincident Center Lighting on OI Sled with Strobe Arms');
xlim([-20, 60]);

export_fig('CoincidentCenterLighting_Fits.pdf');

