Skip to content

Instantly share code, notes, and snippets.

@prachiisc
Created September 9, 2020 16:23
Show Gist options
  • Save prachiisc/4668febcef55f6d857863ca9ffd920bd to your computer and use it in GitHub Desktop.
Save prachiisc/4668febcef55f6d857863ca9ffd920bd to your computer and use it in GitHub Desktop.
p = [0.2 0.8]; % Mixing proportions
mu = [1 2;-3 -5]; % Means
sigma = cat(3,[2 .5],[1 1]); % Covariances 1-by-2-by-2 array
gm = gmdistribution(mu,sigma);
fsurf(@(x,y)reshape(pdf(gm,[x(:),y(:)]),size(x)),[-10 10]);
xlabel('x1')
ylabel('x2')
zlabel('p(x)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment