function conicSectionPlot_(Pvec,lowerx,upperx,lowery,uppery,lineStyle)
% Plots the conic section (ellipses, parabolas and hyperbolas)
% determined by the equation
%     p(1)*y^2 + p(2)*x*y + p(3)*x + p(4)*y + p(5) = x^2
% The 5 parameters of the conic section p(1) - p(5) 
% are stored in the column or row vector Pvec.
% lowerx and upperx specify the lower and upper limits
% of the grid for the contour plot along x.
% lowery and uppery specify the lower and upper limits
% of the grid for the contour plot along y.
% E.g. lowerx = -2.25, upperx = 2.25, lowery = 0, uppery = 6.
% lineStyle is a string specifying the way the contour line is plotted.
% E.g. lineStyle = 'r-', for a red solid line, & 'b--' for a blue dashed line.
% At the command line type help plot to find out the choices for the
% color and line type (solid, dashed, etc)

% generate a 2 dimension mesh for contour plot etc.
[X,Y] = meshgrid(lowerx:0.05:upperx,lowery:0.05:uppery);
% compute a matrix whose zeroes define the orbit trajectory
Z = Pvec(1)*Y.^2 + Pvec(2)*X.*Y + Pvec(3)*X + Pvec(4)*Y + Pvec(5) - X.*X;
% plot the contour at level 0
contour(X,Y,Z,[0 0],lineStyle)
colormap(1-white)
