Projection of 3D positions histograms in planes XY, YZ, and XZ

9 ビュー (過去 30 日間)
Yatish Chandra
Yatish Chandra 2020 年 6 月 29 日
編集済み: Yatish Chandra 2020 年 7 月 1 日
I have N points whose 3D coordinates are given. I want to plot 2D histograms for the x- and y-coordinates on XY plane at Z=0 of a 3D box. Next, on the adjacent walls of this box, I have to plot 2D histograms for y- and z-coordinates on YZ plane at X=0 and 2D histogram for x- and z-coordinates on XZ plane at Y=0.
  2 件のコメント
darova
darova 2020 年 6 月 30 日
Use hist3 to calculate a matrix of values
Yatish Chandra
Yatish Chandra 2020 年 6 月 30 日
Yes, 'hist3' takes in any Nx2 matrix to plot histograms bars in 3D. I am not sure how that helps?

サインインしてコメントする。

採用された回答

darova
darova 2020 年 6 月 30 日
Here is an example
m = 20;
% generate some data
n = 500;
x = randn(500,1);
y = randn(500,1);
z = randn(500,1);
% create regular grid
x1 = linspace(min(x),max(x),m);
y1 = linspace(min(y),max(y),m);
[X,Y] = meshgrid(x1,y1);
% calculate density matrix
xy = hist3([x y],[m m]);
plot3(x,y,z,'.r')
surface(X,Y,xy*0-5,'cdata',xy)
axis vis3d
  4 件のコメント
Yatish Chandra
Yatish Chandra 2020 年 6 月 30 日
Thanks! It worked
darova
darova 2020 年 7 月 1 日
My pleasure

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by