To plot an ellipse you can use its equation. An ellipse has a major and a minor axis. Also we want to be able to plot the ellipse on different center points. Therefore we write a function whose inputs and outputs are:
Inputs: r1,r2: major and minor axis respectively C: center of the ellipse (cx,cy) Output: [x,y]: points on the circumference of the ellipse
You can use the following function to get the points on an ellipse and then plot those points.
function [x,y] = getEllipse(r1,r2,C) beta = linspace(0,2*pi,100); x = r1*cos(beta) - r2*sin(beta); y = r1*cos(beta) + r2*sin(beta); x = x + C(1,1); y = y + C(1,2); end
[x,y] = getEllipse(1,0.3,[2 3]); plot(x,y);