필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Noob
Noob 2017년 6월 16일
답변: Giulio Antufermo 2020년 1월 14일
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
KSSV
KSSV 2017년 6월 16일
Thanks is accepting the answer...
KSSV
KSSV 2017년 6월 16일
YOu have to run it in a loop....
for i = 1:length(x_i) ;
P(:,i) = R * [x_i(i) ; y_i(i)];
end

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

추가 답변 (1개)

Giulio Antufermo
Giulio Antufermo 2020년 1월 14일
It didn't really work for me

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by