I need to create a 3D histogram using the mesh function.
I have data from an experiment where coordinates in X and Y
are recorded from an origin. I want the 'Z' value to
indicate the frequency (how many times that particular X
and Y coordinate is the same).
I have this information in a matrix in three columns.
I tried using the mesh function directly on the matrix, but
the graph I got is not right. Even the axes don't
corrospond to the range of the values in the columns in the
matrix.
To reiterate... if this was a 2D plot, I'd be looking at
the coordinates of an XY plot from "above". I want the Z
axis to indicate the frequency for each coordinate.
Would appreciate any help...
Thanks,
Preet
Preet, if it helps at all, the Statistics Toolbox has the HIST3 function
that creates 3D histograms.
With HIST3 I can only specify a matrix with 2 columns...
that means I can't input the frequency data.
But I need to offset my axes and I don't know how...
for example, take the following 2d matrix:
0 0 0 0 0
0 0 2 0 0
0 1 1 0 0
0 0 0 0 0
0 0 0 0 0
When it's plotted, the graph X and Y axes are like follows:
X: 0 1 2 3 4
-------------
Y: 0| 0 0 0 0 0
1| 0 0 2 0 0
2| 0 1 1 0 0
3| 0 0 0 0 0
4| 0 0 0 0 0
But I need my axes to be like this:
X: -2-1 0 1 2
-------------
Y: -2| 0 0 0 0 0
-1| 0 0 2 0 0
0| 0 1 1 0 0
1| 0 0 0 0 0
2| 0 0 0 0 0
I'm so close to getting my plot perfect!
Any ideas?
Thanks,
Preet