how to create mahalanobis function in matlab?

12 vues (au cours des 30 derniers jours)
Brity Jain
Brity Jain le 2 Oct 2018
I want to create mahalanobis function in matlab not by using direct 'mahal' function.

Réponses (1)

VM Sreeram
VM Sreeram le 5 Juil 2023
Here’s an example implementation of mahalanobis function:
function d = mahalanobis(x, y, C)
d = sqrt((x-y) * inv(C) * (x-y)');
end
Here, x and y are the two vectors between which you want to calculate the Mahalanobis distance, and C is the covariance matrix. You can use this function to calculate the Mahalanobis distance between x and y by passing these arguments to the function.

Catégories

En savoir plus sur Denoising and Compression dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by