function Q = randq(n)
% RANDQ : create random orthogonal matrix
% Q = randq(n) creates an n-by-n random orthogonal matrix
% with determinant (-1)^(n-1)

A = randn(n);
[Q,R] = qr(A);