Draw angle on a MATLAB figure
43 views (last 30 days)
Show older comments
I want to be able to select a random point on a graph, and then draw a dotted line that goes from the origin to that point, and then a dotted line that goes from that point straight down towards the x-axis, and then this is the part I do not know how to do... I want to draw that little arc symbol with a greek letter indicating the angle that the first line makes with the x-axis. How do I do that?

Something similar to that little green arc, with a greek letter right next to it. Thank you!
0 Comments
Answers (1)
Alan Stevens
on 9 Feb 2021
Something like this:
x = [0 1]; y = [0 1.5];
theta = atan(y(2)/x(2));
th = 0:1/360:theta; r = 0.1;
xx = r*cos(th); yy = r*sin(th);
plot(x,y,xx,yy),grid
axis([0 2 0 2])
text(r,r,'\theta')
0 Comments
See Also
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!