function [y] = spm_MNpdf (m, C, x)
% Evaluate a Multivariate Gaussian PDF
% FORMAT [y] = spm_MNpdf (m, C, x)
% 
% m     [d x 1] mean
% C     [d x d] covar
% x     [n x d] points at which to evaluate
%
% y     [n x 1] density at n points
%___________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% Will Penny 
% $Id: spm_MNpdf.m 3995 2010-07-13 17:19:49Z karl $

ic     = inv(C);
[n, d] = size(x);

x    = x - ones(n, 1)*m(:)';
fact = sum(((x*ic).*x), 2);

y    = exp(-0.5*fact);
y    = y./sqrt((2*pi)^d*det(C));

spm
github-repos/MATLAB/spm-spm12/spm12-3085dac00ac804adb190a7e82c6ef11866c8af02/toolbox/mixture/spm_MNpdf.m
spm12
github-repos/MATLAB/spm-spm12
3085dac00ac804adb190a7e82c6ef11866c8af02