Determining the length of a 3D spiral

조회 수: 6 (최근 30일)
Hassan Moheb Abdulrahman Yousef
Hassan Moheb Abdulrahman Yousef 2022년 2월 20일
편집: Image Analyst 2022년 2월 20일
I made a program to create a spiral but I don't know how to determine the length of it.
clear all
clc
dh=0.5; %step depth
a=45; %angle of inclination of cone
h=30; %depth of the cone
R1=50; %largest radius of the cone
D=R1*tand(a);
N=h/dh; %Number of loops or contour
m=1;
for n=0:1:360*N %dividing a loop into 360 angles
Z(m)=0-((dh/360)*n);
R=R1-(((dh/360)*n)/tand(a)); %radius at any depth
X(m)=R*cosd(n);
Y(m)=R*sind(n);
m=m+1;
end
plot3(Y,X,Z,'y') %3d visualization of helix

채택된 답변

Image Analyst
Image Analyst 2022년 2월 20일
Did you try the Euclidean distance? Something like
deltaX = diff(X);
deltaY = diff(Y);
deltaZ = diff(Z);
distance = sum(sqrt(deltaX.^2 + deltaY.^2 + deltaZ.^2))
  댓글 수: 4
Hassan Moheb Abdulrahman Yousef
Hassan Moheb Abdulrahman Yousef 2022년 2월 20일
I am very grateful for your help.
Image Analyst
Image Analyst 2022년 2월 20일
Did it solve it? If so, could you click the "Accept this answer" link? 🙂

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by