function M= covM(S,a,b,c,d)
nDim=length(S);
%return standard deviation matrix (is squared in code after)
if nDim==4
M= diag([stdPos(S(1),c), stdPos(S(2),c), stdVel(S(3),a,b), stdVel(S(4),a,b)]);
elseif nDim==6
%need to change to model 3d pos and vel 
sdvec= [stdPos(S(1),c), stdPos(S(2),c), stdPosDep(S(1),S(2),S(3),d), stdVel(S(4),a,b), stdVel(S(5),a,b)];
M=diag([sdvec , stdVelDep(sdvec(3))]);

end
