A matrix visualization 3d-histogram
3 views (last 30 days)
Show older comments
I have a (1372x3) matrix consisting 3 vectors r(1372x1),m(1372x1) and n(1372x1).
these vectors must be arranged in 3D histogram, where a sum of "n" controls the height. Vector n consists entirely of 1 and 0.5
also to be understood as "r" is the x-axis and "m" is the y-axis and "n" is the z-axis.
it would be really cool if i could control the division of r and m with a input of 'k'.
thanks!!!!
1 Comment
Sean de Wolski
on 14 May 2013
A small example of inputs/operations/expected outputs would go a long way if Stephan's answer doesn't resolve this.
Answers (1)
Stephan M. H.
on 14 May 2013
Edited: Stephan M. H.
on 14 May 2013
Hi Frederik,
from your explanation r(i) and m(i) correspond to and x-y position where n(i) is the z value at this point. If so, than you should have information of where your x-grid points and y-grid points are and therefore the dimension of your z-matrix.
A straight forward way of realizing a 3D histogram in your case would then make use of meshgrid and hist3 .
The steps you need to do is create monotonic vectors x and y containing your grid points in both dimension. Then obtain the mesh data
[X,Y]= meshgrid(x,y)
Reshape your n-vector using
Z = reshape(n,a,b)
where a and b are the dimensions of your x and y grid vectors.
This should work, although your explanation with x,y,z doesn't correspond to "control with sum of n", which you stated before and I don't quite get. Same goes for the control input k, which didn't explain enough.
best, Stephan
1 Comment
Daniel Bridges
on 2 Apr 2016
Is Stephan basically creating an x-y bar graph? I don't see that this answer addresses the case where you have a random set of (x,y,z) points, i.e. z not referring to a location's height; where z is not a one-to-one function of x and y. (For example, having both points (1,1,3) and (1,1,-2) in the set, and really wanting to count how many times each ordered pair appears.)
See Also
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!