A = [2 1; 1 2];
A=round(10*randn(2))
theta = 0:pi/50:2*pi;  %pi is scilab for the constant pi
n = size(theta,2); % // theta is a 1 x n row vector
x = zeros(size(theta)); % // x and y start as zero vectors
y = zeros(size(theta));
for i = 1:n,
angle = theta(i); % // this angle
c = cos(angle);
s = sin(angle);
X = [ c, s ];
r = sqrt(1/abs(X*A*X')); % // formula from section 4
x(i) = r*c; % // r cos(theta)
y(i) = r*s;
end;
plot(x,y,'r*-');
title('Plot of conic')
