MATLAB: How to draw a ellipses with known foci

ellipses

Hi all,
I have a fixed foci in an image in Matlab, and I am wondering how to draw a ellipses with this known foci and get the pixels within the ellipses, and finally group these pixels into several sets according to their different distances to one foci point?
Thanks.

Best Answer

Joy, you can use the FAQ http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_ellipse.3F to get x and y coordinates, or use Joseph's code - either way. Then, to write into an image, you can just run through your x,y list:
for k = 1 : length(y);
row = round(y);
column = round(x);
binaryImage(row, column) = true;
end