0
如何使用mesh()
繪製高斯在2D,這個MATLAB函數裏面......摹輪廓Matlab的
function G(Mean,Cov,c)
icov = inv(Cov);
det_cov = det(Cov);
const = 1/(2*pi*sqrt(det_cov));
xx = linspace(Mean(1)-3*sqrt(Cov(1,1)),Mean(1)+3*sqrt(Cov(1,1)));
yy = linspace(Mean(2)-3*sqrt(Cov(2,2)),Mean(2)+3*sqrt(Cov(2,2)));
[x y] = meshgrid(xx,yy);
mx=x-Mean(1);
my = y-Mean(2);
z=const*exp(-0.5*(icov(1,1)*mx.^2+icov(2,1)*mx.*my +icov(2,1)*my.*mx+icov(2,2)*my.^2));
contour(x,y,z,c);