필터 지우기
필터 지우기

how can I draw a line knowing just the midpoint and the angle?

조회 수: 4 (최근 30일)
Mark
Mark 2015년 3월 17일
댓글: Mark 2015년 3월 17일
how can I draw a line knowing just the midpoint and the angle?

채택된 답변

Hugo
Hugo 2015년 3월 17일
You can do this
midpoint=[a,b]; % This defines the midpoint. You should give a and b some value. lineangle=c; % This defines the angle. Use this if your angle is in radians. lineangle=c*pi/180; % This defines the angle. Use this if your angle is in degrees.
L=1; % This defines the length of the line
x=[-.5,.5]*L*cos(angle)+midpoint(1); y=[-.5,.5]*L*sin(angle)+midpoint(2); plot(x,y);
That's all
Hope this helps.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by