display('Starting Normal Plotting');

mu_1 = 1;
mu_2 = -1;
sigma_1 = 0.25;
sigma_2 = 1.5;
corr_coeff = 0.3;

mu = [mu_1 mu_2];
Sigma = [sigma_1.^2 corr_coeff .* sigma_1 .* sigma_2; corr_coeff .* sigma_1 .* sigma_2 sigma_2.^2];
x1 = -3:.1:3; x2 = -3:.1:3;

figure(1);
[X1,X2] = meshgrid(x1,x2);
F = mvnpdf([X1(:) X2(:)],mu,Sigma);
F = reshape(F,length(x2),length(x1));
surf(x1,x2,F);
caxis([min(F(:))-.5*range(F(:)),max(F(:))]);
axis([-3 3 -3 3 0 .4])
xlabel('x1'); ylabel('x2'); zlabel('Probability Density');

figure(2);
contour(x1,x2,F);
xlabel('x1');
ylabel('x2');
title('Probability Density Contour Plot');

figure(3);
subplot(2,1,1);
F = mvnpdf(x1', mu_1, sigma_1);
plot(x1, F);
title('Marginal Probability Density for X');

subplot(2,1,2);
F = mvnpdf(x2', mu_2, sigma_2);
plot(x2, F);
title('Marginal Probability Density for Y');
