In my MATLAB program, I have the occurrences of the m-dimensional variable X given in a matrix as
X = [x_11 x_12 ... x_1m;
x_21 x_22 ... x_2m;
.
.
.
x_n1 x_n2 ... x_nm;]
where each is an case for X.
and the probability of each case is given by:
pX = [p_x1 p_x2 ... p_xn];
I am looking for a simple way to calculate covariance matrix of X (a matrix that shows how the dimensions of X is related to each other).
I hope there is a simple way to calculate it in MATLAB, just like Expected value of X which is calculated by:
EX = pX * X;
Edit:
X is a random variable with discrete occurrences specified by X matrix. pX shows probability of each occurrence.