Fixed calculateAngles.m