% returns a pattern function points = patternEllipse(npoints, firstAxis, secondAxis, noiseCov); % We create a circle thetas=[1:npoints] * 2 * pi / npoints; circle=[cos(thetas); sin(thetas)]; % Deform the circle to create ellipse ellipse=diag([firstAxis secondAxis])*circle; % and then add some noise points = ellipse + noiseCov * randn(2, npoints);