⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nearest_mahal.m

📁 wave cluster for biomedical signal proce
💻 M
字号:
function index = nearest_mahal(x,mu,sigma)
% function index = nearest_mahal(x,mu,sigma)
% x is a vector
% mu(i,:) is the mean of the ith Gaussian
% sigma(:,:,i) is the covariance of the ith Gaussian
% 
% Returns the index of the Gaussian closest (by the Mahalanobis distance)
% to x.

N = size(mu,1);  % number of Gaussians
d = [];
if( N == 0 )
    index = 0;
else
    for i=1:N,
        d(i) = (x-mu(i,:))*inv(sigma(:,:,i))*(x-mu(i,:))';
    end
    [m index] = min(d);
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -