Got some problems when trying to plot with a shifting angle in 2D Plotting ?

조회 수: 3 (최근 30일)
when i try to plot from (0,0) it becomes great as the below Pic :
The Codes Are :-
hold on;grid;
ang=30;
theta=0;
for i=0:(360/ang)
xl=[0 15*cos(theta*pi/180)];
yl=[0 15*sin(theta*pi/180)];
plot(xl,yl,'-r')
theta=(i+1)*ang;
end
But when i try to change the Co-ordinates it becomes like this :-
The Codes As Below :-
hold on;grid;
ang=30;
theta=0;
for i=0:(360/ang)
xl=[5 20*cos(theta*pi/180)];
yl=[5 20*sin(theta*pi/180)];
plot(xl,yl,'-r')
theta=(i+1)*ang;
end
Thanks & Sorry for long words :D
  댓글 수: 1
Jan
Jan 2013년 3월 16일
You show us the code and the output, but do not explain, what the actual problem is. Do you expect the graphics to be symmetrical?

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2013년 3월 16일
편집: Jan 2013년 3월 16일
The posted code moves the start points from (0,0) to (5,5) and the end points of each line are located on the circle around (0,0) with radius 20. I guess that you want a circle around (5,5) with radius 15:
hold on;grid;
ang=30;
theta=0;
for i=0:(360/ang)
xl = [5, 5 + 15*cos(theta*pi/180)];
yl = [5, 5 + 15*sin(theta*pi/180)];
plot(xl,yl,'-r')
theta = (i+1)*ang;
end

추가 답변 (1개)

Haytham Mohamed
Haytham Mohamed 2013년 3월 17일
thanks alot Jan Simon it works

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by