G Contour Matlab -


how use mesh() draw gaussians in 2d, inside matlab function...

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); = 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); 

simply replace contour mesh.

also, try not use mean , cov variable names. mean , cov matlab functions, , while spelling different, you're still setting hard-to-find bugs.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -