Draw angle on a MATLAB figure

40 次查看(过去 30 天)
vitor oliveira
vitor oliveira 2021-2-8
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!

回答(1 个)

Alan Stevens
Alan Stevens 2021-2-9
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')

类别

Help CenterFile Exchange 中查找有关 Labels and Annotations 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by