I've used the gmdistribution
to fit data to a Gaussian mixture model. I wanted to plot a contour plot https://i.sstatic.net/d6Pdb.jpg where the contours are obviously missing. For a 1D problem I found fplot
, but now I'm stumped.
I ran into a similar problem when I wrote an EM algorithm for gaussian mixtures. Here is the snippet of code that fixed it in my case:
for l=1:k
zz=gmdistribution(MU(l,:),SIG(:,:,l),PI(l));
ezcontour(@(x,y)pdf(zz,[x y]),[minx1 maxx1],[miny1 maxy1],250);
end
The key is to increase N
:
ezcontour(...,N) plots FUN over the default domain using an N-by-N
grid. The default value for N is 60.