MATLAB: Want to plot a matrix as a 3D histogram or bar chart.

3d matrix histogram plot

I have a matrix (A) of count values. It counts the number of times event (x,y) occurs during a process, where x & y are integer metrics with pre-defined, non-equal ranges (thus A is not square). That is, every time event (9,10) occurs, the accumulator (counter) array is incremented: A(9,10)=A(9,10)+1. I want to plot out the matrix A as a histogram (or bar chart) to examine and analyze the distribution of events. I am aware of bar3 and some MATLAB histogram plotting scripts but I don't see how to make them work, for this application. (I did search the download section here but didn't find what I want.)

Best Answer

With a size of 128 by 1024, you might be better off using surf() than bar3(), or simply viewing it as an image instead of a 2.5-D rendering (a 3-D rendering of your 2-D array onto your 2-D flat screen monitor).
Related Question