counts=[0, 10, 100, 200, 500, 1000, 2000, 5000,10000, 15000, 20000, 25000, 30000, ...
    40000, 50000, 60000, 80000]';
YAW=[4.4101, 4.47659, 4.53887, 4.5413, 4.50031, 4.57034, 4.7697, 4.85355, 5.01046, 5.09556, 5.23243, 5.37868, 5.52271, ...
    5.70495, 6.19392, 6.40595, 7.04433]';


[linfit, gof]=fit(counts, YAW, 'poly1');
h1=figure(1);
plot(counts, YAW, 'o')
hold on
plot(linfit)
xlabel('Counts Length drive')
ylabel('OpLev Yaw (urad)')
hold off
print(h1, -dpng, 'ETMXCoilLength2Yaw')

current=-0.004; %current correction, counts Y/countsL
countsperurad=51.689; %counts Y/urad
newvalue=current+linfit.p1*countsperurad %urad/countsL uncorrected

after=(4.37-2.97)/(100000)

