3de3af7169
git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@9085 ddd99763-3ecb-0310-9145-efcb8ce7c51f
30 lines
606 B
Matlab
30 lines
606 B
Matlab
# 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)
|