  function [Astar, sStar, alfa1Star, beta1Star, alfa2Star, beta2Star] = EnclosingE(x,y)
% x and y are column N-vectorsa 
% An ellipse E with focii (alfa1Star,beta1Star) and (alfa2Star,beta2Star)
% and s-value sStar is computed.
% E encloses the points (x(i),y(i)), i=1:N and has minimal area
% (approximately)


% Compute the center
N = length(x); h = sum(x)/N; k = sum(y)/N;
[a,j] = max(sqrt((x-h).^2+(y-k).^2));
sStar = 2.2*a;
d = .9*sStar;
Astar = pi*(sStar/4)*sqrt(sStar^2-d^2);
c = d/2;
alfa1Star = h + (c/a)*(x(j)-h);
beta1Star = k + (c/a)*(y(j)-k);
alfa2Star = h - (c/a)*(x(j)-h);
beta2Star = k - (c/a)*(y(j)-k);

% NOTE: THIS IMPLEMENTATION DOESN'T LIVE UP TO THE SPECIFICATION!

