zoom/pc/data/20090722/loadlog.m
2009-07-23 20:02:40 +00:00

58 lines
1.3 KiB
Matlab

data=load('log');
dac=data(:,1);
adc=data(:,2);
t=1:size(data,1);
calib=1.385419;
length(t)
%% adc to actual current in (A/ADC count)
scale = computeI/1000;
scale = scale(1); % just the gain part only
%% get the dc value
t=50:100;
dc = mean(dac(t)-calib*adc(t));
% extract the part for the light and pc
t=1080020:1080290; plot(t,dac(t)-calib*adc(t));
tx = (t - t(1))*1/8000; % in min
figure(1); plot(tx*1e3, (dac(t) - calib*adc(t) - dc)/calib*scale,'lineWidth',2); grid on;
xlabel('Time (ms)');
ylabel('Measured current (A)');
axEnd = tx(end)*1e3;
ax = axis;
axis([ax(1) axEnd ax(3) ax(4)]);
%%
t=100090:100358;
figure(2);
tx = (t - t(1))*1/8000; % in second
plot(tx*1e3,(dac(t)-calib*adc(t) - dc)/calib*scale,'lineWidth',2); grid on;
axEnd = tx(end)*1e3;
ax = axis;
axis([ax(1) axEnd ax(3)*2 ax(4)*2]);
xlabel('Time (ms)');
ylabel('Measured current (A)');
%% Keithley stuff
t=1590000:1680000;
tx = (t - t(1))*1/8000/60; % in second
figure(3); plot(tx,dac(t)-calib*adc(t) - dc);
xlabel('Time (s)');
ylabel('Measured current (dac count)');
axEnd = tx(end);
ax = axis;
axis([ax(1) axEnd ax(3) ax(4)]);
figure(4); plot(tx,dac(t)-calib*adc(t) - dc);
axEnd = tx(end);
ax = axis;
axis([ax(1) axEnd -1700 -1550]);
xlabel('Time (s)');
ylabel('Measured current (dac count)');