1 function p=gaussian(x,m,C);
4 % Evaluate the multi-variate density with mean vector m and covariance
5 % matrix C for the input vector x.
9 % Vectorized version: Here X is a matrix of column vectors, and p is
10 % a vector of probabilities for each vector.
21 % fprintf(1,'Covariance matrix close to singular. (gaussian.m)\n');
26 denom=(2*pi)^(d/2)*sqrt(abs(detC));
27 mahal=sum(((x-M)'*inv(C)).*(x-M)',2); % Chris Bregler's trick
28 numer=exp(-0.5*mahal);