3D histogram plot for a tensor data

3 views (last 30 days)
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,

Answers (1)

Rishik Ramena
Rishik Ramena on 18 Mar 2021
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.
@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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by