Calculation of Maximum Directions and Null Directions and plotting them in Matlab