how can I rotate the ellipses based on the orientation angle of (x_i,y_i)?

1 次查看(过去 30 天)
I would like to rotate the ellipses to show the orientation, theta, of the centered data points.

采纳的回答

KSSV
KSSV 2017-6-16
a=5; % horizontal radius
b=10; % vertical radius
x0=0; % x0,y0 ellipse centre coordinates
y0=0;
t=-pi:0.01:pi;
x=x0+a*cos(t);
y=y0+b*sin(t);
plot(x,y)
hold on
%%Rotate the ellipse by 90 degrees
th = pi/2 ;
R = [cos(th) -sin(th) ; sin(th) cos(th)] ;
% Rotate all the points
P = zeros(2,length(x)) ;
for i =1:length(x)
P(:,i) = R*[x(i) ;y(i)] ;
end
xr = P(1,:) ; yr = P(2,:) ;
plot(xr,yr,'r')
  3 个评论

请先登录,再进行评论。

更多回答(1 个)

Giulio Antufermo
Giulio Antufermo 2020-1-14
It didn't really work for me

类别

Help CenterFile Exchange 中查找有关 3-D Scene Control 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by