I am trying to solve a problem using MATLAB regarding Gaussian random vectors. $$ S = ( S_{1} , S_{2} , S_{3} , S_{4}) \sim N_{4}( \mu , Cov (S) ) $$ Given a 4*4 matrix Cov(S) and mu as a 4*1 matrix I have used the following code to calculate S and $$\ find \ cov (X,Y) \ where\ X =\ (S_{1}) \ and \ Y =(S_{2},S_{3},S_{4})^T $$
S = mvnrnd(mu,SIGMA);
X = S(1,1);
Y = S(1,2:4);
EX = mu(1,1);
EY = mu(2:4,1);
covXY = (EX-X)*((EY-Y)');
The problem I have run into is that my result for Cov(X,Y) does not have positive values on the diagonal and is not symmetric, does this have anything to do with the fact that I am taking the covariance of two different sized vectors?