A matrix visualization 3d-histogram

1 回表示 (過去 30 日間)
Frederik Jonassen
Frederik Jonassen 2013 年 5 月 14 日
コメント済み: Daniel Bridges 2016 年 4 月 2 日
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
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.
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
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 ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by