distance_mahalanobis.m

来自「This a collection of MATLAB functions fo」· M 代码 · 共 17 行

M
17
字号
function M = distance_mahalanobis(v,S)
%function M = distance_mahalanobis(v,S)
%
% INPUTS:
%   v - a set of innovation vectors.
%   S - the covariance matrix for the innovations.
%
% OUTPUT:
%   M - set of Mahalanobis distances for each v(:,i).
%
% Tim Bailey 2005.

Sc = chol(S)';
nv = Sc\v; % "normalised innovation", equivalent to writing inv(Sc)*v
M = sum(nv.*nv, 1);
% Note: writing sum(x.*x, 1) is a fast way to compute sets of inner-products.

⌨️ 快捷键说明

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