Draw angle on a MATLAB figure

조회 수: 40 (최근 30일)
vitor oliveira
vitor oliveira 2021년 2월 8일
답변: Alan Stevens 2021년 2월 9일
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