function r=rate(t,q)

eps=ones(length(t))/10^10; % small unit to prevent overflows

r=-sum(sum( q.*log2(q+eps)./(t+eps) ))*16000;
