Updated the code to compute the angles before running the simulations. The function to compute the angles is now a separate file: 'optimTheta' . This allows the use of 'parfor' when computing angles so it speeds up the code a bit when going through many K values.