function [rbhata,rmahal,rcorr]=bmc(x1,x2)

c1=cov(x1,1);
c2=cov(x2,1);
c=(c1+c2)./2;

m1=mean(x1);
m2=mean(x2);

rmahal=((m2-m1)/c)*(m2-m1)';
rcorr=2.*log(det(c)./sqrt(det(c1).*det(c2)));
rbhata=rmahal./8+rcorr./4;
