Gaussian mixture distribution plot
1 view (last 30 days)
Show older comments
I'm trying to bild a gaussian mixture distribution. I'm quite new on Matlab, but I think the script is ok. I'm not able to plot my distribution. Here you can find what I have. Many thanks for your answers, cheers
%quadmodal mixture
mu=[30 0 0 0; 22 0 0 0;12 0 0 0;4 0 0 0];
sigma=cat(3,[9^2 0 0 0;0 6.6^2 0 0;0 0 3.6^2 0;0 0 0 1.2^2],[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1],[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1],[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1]);
p=ones(1,4)/4;
obj = gmdistribution(mu,sigma,p);
ezsurf(@(x,y)pdf(obj,[x y]),[-25 25],[-25 25])
1 Comment
zepp
on 30 Apr 2014
your mixture distribution has four dimensions, so you cannot plot that using ezsurf. Are you sure you have initialised the mu and sigma values correctly? Or is it just a 1 dimensional 4 component Gaussian distribution?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!