The other day I was doing a Monte Carlo analysis where I had two independent varables and one scalar output. A good visualization for this is a two dimensional histogram
. Unfortunatly, these are not directly supported in MATLAB, but thankfully Kangwon Lee has developed one and shared it with the rest of us.
This code came with a good example, and was well documented. These things are often overlooked (Hint, Hint Hint), so I am glad to see they were done this time.
This is the code I used to create the screenshot you see here, mostly a de-generalization of the example with a more intuitive dataset:
N = 160000;
nBins = 30;
z = randn(N, 2);
edges = linspace(-1,1,nBins);
mHist2d = hist2d(z,edges,edges);
edgeLabel = 0.5*(edges(1:end-1)+edges(2:end));
title('2d hist of two normally distributed random variables')