二元正态

matlab绘制二元正态

mu = [0 0];
Sigma = [1 0.8; 0.8 1];
[X,Y]= meshgrid(-3:0.1:3,-3:0.1:3);
p = mvnpdf([X(:) Y(:)],mu,Sigma);
p = reshape(p,size(X));
figure
set(gcf,'Position',get(gcf,'Position').*[1 1 1.3 1]
subplot(2,3,[1 2 4 5])
surf(X,Y,p),axis tight,
title('二维正态分布图')
subplot(2,3,3)
surf(X,Y,p),view(2),axis tight,
title('在XOY面上的投影')
subplot(2,3,6)
surf(X,Y,p),view([0 0]),axis tight,
title('在XOZ面上的投影')

你可能感兴趣的:(matlab)