Created
February 7, 2020 11:05
-
-
Save williamFalcon/dc4ba4473a8663aaa9d80bd89afdbf47 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mu = [2 0]; | |
sigma = [1 0; 0 1]; | |
mu10 = [-2 0]; | |
sigma10 = [1 0; 0 1]; | |
mu2 = [-4 -4]; | |
sigma2 = [1 0; 0 1]; | |
mu3 = [4 4]; | |
sigma3 = [1 0; 0 1]; | |
mu4 = [-6 0]; | |
sigma4 = [1 0; 0 1]; | |
mu5 = [6 0]; | |
sigma5 = [1 0; 0 1]; | |
mu6 = [0 -6]; | |
sigma6 = [1 0; 0 1]; | |
mu7 = [0 6]; | |
sigma7 = [1 0; 0 1]; | |
mu8 = [-4 4]; | |
sigma8 = [1 0; 0 1]; | |
mu9 = [4 -4]; | |
sigma9 = [1 0; 0 1]; | |
x1 = -10:0.2:10; | |
x2 = -10:0.2:10; | |
[X1,X2] = meshgrid(x1,x2); | |
X = [X1(:) X2(:)]; | |
y = mvnpdf(X,mu,sigma) + mvnpdf(X,mu2,sigma2) + mvnpdf(X,mu3,sigma3) + mvnpdf(X,mu4,sigma4) + mvnpdf(X,mu5,sigma5) + mvnpdf(X,mu6,sigma6) + mvnpdf(X,mu7,sigma7) + mvnpdf(X,mu8,sigma8) + mvnpdf(X,mu9,sigma9) + mvnpdf(X,mu10,sigma10); | |
y = reshape(y,length(x2),length(x1)); | |
surf(x1,x2,y) | |
caxis([min(y(:))-0.5*range(y(:)),max(y(:))]) | |
axis([-10 10 -10 10 0 0.4]) | |
xlabel('x1') | |
ylabel('x2') | |
zlabel('Probability Density') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment