I am working on a project where I am trying to replicate a randomized experiment from an observational study data, using Mahalanobis distance matching to ensure that the control and treated groups are similar. I have seen several websites talking about Mahalanobis distance as the distance between a point and a distribution. However, from what I understand from this academic paper (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2943670/), and this website (http://mccormickml.com/2014/07/22/mahalanobis-distance/), the Mahalanobis distance can also be calculated between two points (each point representing a vector of features).
So that is what I am trying to do as some sources say Mahalanobis distance is a better measure than the Euclidean distance. However the Mahalanobis distance involves using the inverse of the covariance matrix of the data-set used. Some of the values in my covariance matrix turn out to be very small (close to 0), and when I try to calculate the inverse of this covariance matrix on Matlab, I seem to get a matrix of inifinity values.
Does anyone know how to tackle this problem? Am I understanding something wrong?