How to calculate distance between two ginput?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
VALARMATHY K
am 10 Nov. 2017
Kommentiert: Birdman
am 10 Nov. 2017
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 ?

0 Kommentare
Akzeptierte Antwort
Birdman
am 10 Nov. 2017
Bearbeitet: Birdman
am 10 Nov. 2017
%%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 Kommentare
Birdman
am 10 Nov. 2017
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Object Identification finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!