Plot ellipsoids with an azimuth angle

조회 수: 3 (최근 30일)
P_L
P_L 2019년 3월 1일
댓글: P_L 2019년 3월 10일
Hi there,
I have found this code online to plot an ellipse. However, the data I have contains the azimuth of the ellipse. How would I amend this code to plot the angle e.g. 70 degrees? when i replace the 0.01 in the code below or just put theta = 70, it doesn't plot anything.
Apprecaite your help in advance!
Many thanks :)
xCenter = 12.5;
yCenter = 10;
xRadius = 2.5;
yRadius = 8;
theta = 0 : 0.01 : 2*pi;
%theta= 70
x = xRadius * cos(theta) + xCenter;
y = yRadius * sin(theta) + yCenter;
plot(x, y,'r-', 'LineWidth', 3);
axis square;
%xlim([0 20]);
%ylim([0 20]);
grid on;

채택된 답변

KSSV
KSSV 2019년 3월 1일
YOu may rotate the ellipse at desired angle using rotation matrix.
xCenter = 12.5;
yCenter = 10;
xRadius = 2.5;
yRadius = 8;
theta = 0 : 0.01 : 2*pi;
%theta= 70
x = xRadius * cos(theta) + xCenter;
y = yRadius * sin(theta) + yCenter;
plot(x, y,'r-', 'LineWidth', 3);
T = 70*pi/180 ;
R = [cos(T) -sin(T) ;
sin(T) cos(T) ] ;
P = [x ; y] ;
P1 = R*(P-mean(P,2))+mean(P,2) ;
x1 = P1(1,:) ;
y1 = P(2,:) ;
hold on
plot(x1,y1,'b')
  댓글 수: 1
P_L
P_L 2019년 3월 10일
Hi KSSV, I ahve been trying to manipulate your answer into what I need but I am struggling.
I have for example data that has an error and an associated azimuth angle. I am wanting to plot an ellipse representing the area of error around each of my data points.
so I have for example my x,y data point with the error given by an amount 'Eminaxis' and 'Emaxaxis' and the azimuth to give the direction in which the ellipsoid points.
Is this something you could help further with?
Many Thanks

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

추가 답변 (0개)

카테고리

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