function plotdelta(delta);

% PLOTDELTA(delta);
%
% 		Plots the averaged deltas returned by the
% 		function RETRIEVE
%
% 		delta      : vector containing averaged deltas
%
%
% University of Rhode Island
% Dept. of Electrical Engineering
% Roger Meier, May '99

bitlength=length(delta);
% Calculate adaptive treshhold
% ----------------------------
thres=(delta(1)+delta(2))/2;
% Displaying averaged deltas
% --------------------------
one_bits_num = find(delta > thres);
one_bits = delta(one_bits_num);        
zero_bits_num = find(delta < thres);
zero_bits = delta(zero_bits_num);        
plot(one_bits_num,one_bits,'r+',zero_bits_num,zero_bits,'bo')
grid
line([1 bitlength],[thres thres],'Color',[0.7 0.7 0.7],'LineWidth',3)
text(2,thres+0.1*max(delta),['Adaptive Threshold: ' num2str(thres)])
axis([1 bitlength 1.1*min(delta) 1.1*max(delta)])
legend('one bits','zero bits',0);
xlabel('Bit Number')
ylabel('Delta')