%
% Plot_Ellipse(x,y,theta,a,b)
%
% This routine plots an ellipse with centre (x,y), axis lengths a,b
% with major axis at an angle of theta radians from the horizontal.
%
% *** Note: many students had a LOT of trouble with this.
%           I suggest you take a little time to look at this routine
%           to see how it works.  It's only four lines of code, but
%           some people spent hours trying to write something like
%           this themselves last year.
%

%
% Author: P. Fieguth
%         Jan. 98
% Modified to use linspace and colour selection: D.A. Clausi, Jan/03
%

function plot_ellipse(x,y,theta,a,b,symbl)

if nargin<5, error('Too few arguments to Plot_Ellipse.'); end;
if nargin == 5
    symbl = 'r';
end

ang = linspace(0,2*pi,101);
pts = [x;y]*ones(size(ang)) + [cos(theta) -sin(theta); sin(theta) cos(theta)]*[cos(ang)*a; sin(ang)*b];
plot( pts(1,:), pts(2,:), symbl );
