clear; figure(1);clf;  daqreset;


%%% parameters for the experiment
sample_rate = 1000;  
duration = 1;  

%%% Set up the parameters to acquire the data
AI = analoginput('nidaq','Brian');    
chan = addchannel(AI,[0;1]);
set(AI,'SampleRate',sample_rate);
set(AI,'SamplesPerTrigger',duration*sample_rate);
set(AI.Channel(1),'InputRange',[-5 5]);

AO = analogoutput('nidaq','Brian');    
chan = addchannel(AO,[0 ]);

Vc = 2.5; dV = .50;         %%% Vc - common, dV is change
putsample(AO,Vc+dV);

start(AI);

[data time] = getdata(AI);  %% get the dataa


plot(time,data)
fprintf('Mean value ch0, %f V ch1 %f V, difference is %f mV\n',...
    mean(data(:,1)),mean(data(:,2)),(mean(data(:,1))-mean(data(:,2)))*1000 );


delete(AI);
clear AI;
