3D histogram plot for a tensor data

조회 수: 3 (최근 30일)
SARATH CHANDRA REDDY NALLALA
SARATH CHANDRA REDDY NALLALA 2021년 3월 13일
Hey everyone,
I am begineer in matlab with limited experience in programming. I have a tensor data (x,y,z values) of contact orientation (about 10000 data values). I want to plot these orientation data using a sphere or icosphere such that length of bins represent the number of points oriented in that particular direction. Can anyone please provide some reference code to solve this problem.
I am also adding the data for your reference.
Thanking you in advance,
Sarath

답변 (1개)

Rishik Ramena
Rishik Ramena 2021년 3월 18일
Have a look at the solution posted here. You can use cart2sph to convert your cartesian coordinates to spherical coordinates. Or you can modify the code to work with your cartesian tensor data.
  댓글 수: 3
Rishik Ramena
Rishik Ramena 2021년 3월 18일
The 'theta', 'phi' and 'H' correspond to the azimuth,elevation and r respectively.
SARATH CHANDRA REDDY NALLALA
SARATH CHANDRA REDDY NALLALA 2021년 3월 20일
@Rishik: I guess H should be a vector with size which is a combination of size of theta and phi, therefore H can't be r as 'r' is a column vector. What I did was I have defined theta_vec and phi_vec as
For 50 data points
theta_vec = linspace(0,2*pi,50);
phi_vec = linspace(0,2*pi,50);
[az,el,r] = cart2sph(x(1:50),y(1:50),z(1:50)) % x,y,z are contact orientations % r is coming as 1 for all the 50 points
H = 100*meshgrid(az,el); % If use r here as you suggested it is showing error as it is not equivalent to the theta x phi size
Though the code is running, It is not correctly representing the required orientation may be I done some thing wrong with the 'H'.
Can pls let me know where I am going wrong.
Thanking you in advance,
best wishes
Sarath

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by