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 Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by