Hello,
Use this:
clc;
xc=50;
yc=50;
a=25;
b=100;
m = 1000;
x = zeros(m,1);
y = zeros(m,1);
theta = linspace(0,2*pi,m);
for k = 1:m
x(k) = a * cos(theta(k));
y(k) = b * sin(theta(k));
end
alpha = input('Enter the rotation angle');
R = [cos(alpha) -sin(alpha); ...
sin(alpha) cos(alpha)];
rCoords = R*[x' ; y'];
xr = rCoords(1,:)';
yr = rCoords(2,:)';
plot(x+xc,y+yc,'r');
grid on;
hold on;
axis equal;
plot(xr+xc,yr+yc,'b');
Red ellipse is the original one and Blue is the rotated one.
Best Answer