Draw a 3D model having x,y and z coordinates

조회 수: 5 (최근 30일)
Borja Zamarreño
Borja Zamarreño 2020년 6월 6일
댓글: Borja Zamarreño 2020년 6월 6일
Hello everyone i would like to know if you can help me with this question. I have an (6000x3) array, where the columns represents x,y and z coordinates of a point that when u link all of the points , they form a cylinder.
Is posible to create the model with those coordinates?
  댓글 수: 3
Borja Zamarreño
Borja Zamarreño 2020년 6월 6일
Can it be an excel file?
KSSV
KSSV 2020년 6월 6일
Upto you...

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

채택된 답변

KSSV
KSSV 2020년 6월 6일
Your coordinates given are not forming a full cylinder. If you join them, you will not get a perfect cylinder as expected. As you said the points form a cyinder; I used the points to get radius and height of the cylinder, from this cylinder has been plotted.
data = xlsread("coordinates.xlsx") ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
% Get radius of the Cylinder
Radius = mean(sqrt(x.^2+y.^2)) ;
% Center of cylinder
C = [0. 0.] ;
% Get height of the cylinder
Height = max(z) ;
% form cylinder
theta = 360. ; % Angle of the Cylinder
%
NH = 50 ; % Number of Elements on the Height
NT = 50 ; % Number of Angular Dicretisation
% Discretizing the Height and Angle of the cylinder
nH = linspace(0,Height,NH) ;
nT = linspace(0,theta,NT)*pi/180 ;
[H T] = meshgrid(nH,nT) ;
% Convert grid to cylindrical coordintes
X = Radius*cos(T);
Y = Radius*sin(T);
Z = H ;
surf(X,Y,Z)
hold on
plot3(x,y,z,'.k')
  댓글 수: 1
Borja Zamarreño
Borja Zamarreño 2020년 6월 6일
Wow, thank you very much KSSV, this really helps me. Now that i can see those points in the cylinder, will help a lot.
Again, thanks. Regards.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by