% The University of Queensland % School of Information Technology & Electrical Engineering % ENGG7302 Advanced Computational Techniques in Engineering % Plot the joint p.d.f.s of a pair of Gaussian r.v.s mu = [0, 0]; % zero mean [x, y] = meshgrid(-2:0.1:2); % create mesh over which to calculate p.d.f.s Sigma1 = eye(2); % First case, the r.v.s are independent f1 = exp(-(Sigma1(1,1)*x.^2 + (Sigma1(1,2)+Sigma1(2,1))*x.*y ... + Sigma1(2,2)*y.^2)/2) / (2*pi*sqrt(abs(det(Sigma1)))); figure(1); surf(x,y,f1); view([-45,70]); Sigma2 = [1, 0.5; 0.5, 1]; % Second case, the r.v.s have corr. 0.5 f2 = exp(-(Sigma2(1,1)*x.^2 + (Sigma2(1,2)+Sigma2(2,1))*x.*y ... + Sigma2(2,2)*y.^2)/2) / (2*pi*sqrt(abs(det(Sigma2)))); figure(2); surf(x,y,f2); view([-45,70]);