# Make a histogram of the error (in milliamps) a=load("log2-locked"); len=size(a,1) keith=a(:,3); calib=a(1,4) dac=a(:,5); adc=a(:,6); #lookup=load("../../../firmware/lookup.inc"); meas=-(dac - calib * adc); keith_amps = keith * 50; # 50 turns p = polyfit(meas, keith_amps, 1) meas_amps = meas * p(1) + p(2); # calibration fit err_amps = keith_amps - meas_amps; [n, x] = hist(err_amps*1000, [-15:0.5:15]); for i = 0:30 cumulative(i+1)=sum(n((31-i):(31+i))/len); endfor figure(1); plot(x(31:61),cumulative); savedata = [ x' n' ]; save("-ascii", "hist.dat", "savedata"); figure(2); bar(x,n)