t = 0:0.01:1;

%Target location
x0 = 2;
y0 = 2;

%Generate the ellipse
x = 2*cos(2*pi*t);
y = 1*sin(2*pi*t);

%Calculate theta to orient robot toward target at all times
theta = atan2(y0-y, x0-x);

figure;
plot(x,y);
hold on;
plot(x0,y0,'rx')
axis image;

figure;
subplot(3,1,1);
plot(t,x);
ylabel('Xb')

subplot(3,1,2);
plot(t,y);
ylabel('Yb')

subplot(3,1,3);
plot(t, unwrap(theta)*180/pi);
ylabel('Theta');
xlabel('Time');