Thanks for providing these files to the comunity !
However, did you check the othogonality of the functions created?
It seems to me that something's wrong there.
I generated 2 polynoms like it is shown in the doc :

12 Jun 2012 @JUAN CARDENAS
n = floor((-1+sqrt(1+8*p))/2);
m=-(n-2*p+n.*(n+1));

Very good solution for using any p but
I think you were missing a '-'sign for your definition of m. (can be seen when plotting the Zernike-Polynomials)