In the optical system analysis, fabrication, and test community, two different sets of Zernike polynomials are commonly used. These sets are both different than the one provided by Paul Fricker by his Zernfun2.m, part of his very helpful Zernike package.
Zernfun2a allows one to select either the University of Arizona "Fringe" set or the so-called 'Standard" or "Noll" set of Zernikes. The former is commonly used in optical fabrication and testing. The latter is often used in optical system performance analysis and theoretical studies.
The way that different sets of Zernike polynomials have been defined causes much confusion and difficulty in communication between individuals working in different organizations. This file is offered in the hope that it will help eliminate some of this.
As an example, some optics people define angles as being measured from the local Y axis rather than the local X axis! While the current file does not deal with that issue (both Paul and I define angles as being measured from the X axis), it does handle the wildly different definitions of exactly which Zernike terms are included in the first 36 or 37 terms, and what the exact ordering of these terms is.
Great function, but because of not available even oder odd-function this function was not usable for newer versions of MATLAB.
I have changed for the section:
if Ordering == 'Noll'
the following three lines (old --> new):
ind = find(odd(n)); --> ind = find(mod(n,2));
ind = find(even(n)); --> ind = find(1-mod(n,2));
ind = find(even(p)); --> ind = find(1-mod(p,2));
Now it works within Matlab 7.6.0 (2008a).
Added comments to provide more references.