Ae = [ 2 1; 1 2]; // ellipse Ah = [ 1 4; 4 3]; // hyperbola Ap = [ 1 1; 1 1]; // parabola // graph theta = 0:%pi/50:2*%pi; n = size(theta,2); PtsInCol = [cos(theta); sin(theta)]; PrsInRow = PtsInCol'; R2e = zeros(theta); R2h = zeros(theta); R2p = zeros(theta); for i = 1:n, R2e(i) = PrsInRow(i,:)*Ae*PtsInCol(:,i); end; for i = 1:n, R2h(i) = PrsInRow(i,:)*Ah*PtsInCol(:,i); end; for i = 1:n, R2p(i) = PrsInRow(i,:)*Ap*PtsInCol(:,i); end; Re = sqrt(1 ./ R2e); Rh = sqrt(1 ./ abs(R2h)); // absolute value to avoid complex numbers. Rp = sqrt(1 ./ R2p); scf(1); clf(); id = color("darkgreen"); // define dark green polarplot(theta, Re,style=2); //blue polarplot(theta, Rh,style=5, strf="000"); //red polarplot(theta, Rp,style=id, strf="000"); //green legend('Ellipse','Hyperbola','Parallel Lines'); xs2eps(1,'polar.eps');