GaussianJointDistCommands.m

From Cohen Courses
Jump to navigationJump to search
% generate the data
D = [randn(1000,2)+1.5; randn(1000,2)-1.5];
%% There are lots of ways to visualize it
[H,C] = hist3(D,[20 20]); 
imagesc(D);
hist3(D,[20 20]);
imagesc(H);
[I,J]=meshgrid(C{1},C{2}); 
plot3(D(:,1),D(:,2),zeros(2000,1)-0.002,'r*');
hold on
surf(I,J,H/2000);
alpha(0.2);