Plot ellipsoids with an azimuth angle
3 ビュー (過去 30 日間)
古いコメントを表示
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;
0 件のコメント
採用された回答
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')
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!