A matrix visualization 3d-histogram
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
Sean de Wolski
2013-5-14
A small example of inputs/operations/expected outputs would go a long way if Stephan's answer doesn't resolve this.
回答(1 个)
Stephan M. H.
2013-5-14
编辑:Stephan M. H.
2013-5-14
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 个评论
Daniel Bridges
2016-4-2
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.)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!