필터 지우기
필터 지우기

How to calculate distance between two ginput?

조회 수: 1 (최근 30일)
VALARMATHY K
VALARMATHY K 2017년 11월 10일
댓글: Birdman 2017년 11월 10일
hai friends i have to calculate distance between two ginput points and also how to calculate angle between 4 ginput.
how to calculate its length?
And how to calculate angle for this ?

채택된 답변

Birdman
Birdman 2017년 11월 10일
편집: Birdman 2017년 11월 10일
%%distance
[x,y]=ginput(2)
len=sqrt((y(2)-y(1))^2+(x(2)-x(1))^2)
%%angle
[x,y]=ginput(4);angle=zeros(1,floor(length(x)/2));
for i=1:floor(length(x)/2)
angle(i)=atan((y(i+2)-y(i+1))/(x(i+2)-x(i+1)));
end
  댓글 수: 4
VALARMATHY K
VALARMATHY K 2017년 11월 10일
Thank you..., but i am not getting value in centimetre, but your first answer helps me.
Birdman
Birdman 2017년 11월 10일
You should not expect to get an answer in centimeter because you can not define any unit for the variable. You just assume that it is centimeter.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by