Finding Angle between 2 points
13 次查看(过去 30 天)
显示 更早的评论
Hello,
I need to calculate the angle between two point from the matlab plot. I tried by applyingthe code which is provided in the discussion but the result is not correct.
The image is attached, I want to find the angle theta which is fromed by point p1,p2 and o.
P1,P2 coordinates are known to us.
I tried using the code provided in the link attached below but the answer is not correct.
I need your help regarding the same.
Thanks in Advance.
Awaiting for response.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/285895/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/285895/image.png)
2 个评论
回答(2 个)
Gifari Zulkarnaen
2020-4-20
Is this what you mean?
P1 = [10 210];
P2 = [140 210];
Z0 = [(P1(1)+P2(1))/2 225]; % Reference point, assuming it is in the middle of P1 & P2
degree = 2*atand((P2(1)-Z0(1))/(Z0(2)-P2(2)));
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!