The problem was not using rank(A,tol)

The problem was not using rank(A,tol). When performing singular value
decomposition, MATLAB approximates the singular values using esp
function. This was creating problems. We were getting different rank
values if moved from 15 to 30 degrees and from 30 to 15 degrees.
This problem was taken care by using tol = 0.01. tol is  the threshold
value for singular values.