function z = zernpol(n,m,r,nflag) ce\]o^4
%ZERNPOL Radial Zernike polynomials of order N and frequency M. b{=2#J-
% Z = ZERNPOL(N,M,R) returns the radial Zernike polynomials of (n05MwKu\
% order N and frequency M, evaluated at R. N is a vector of yo`Jp$G
% positive integers (including 0), and M is a vector with the h!?7I=p~#
% same number of elements as N. Each element k of M must be a $(H%|Oyn
% positive integer, with possible values M(k) = 0,2,4,...,N(k) Ra}%:
% for N(k) even, and M(k) = 1,3,5,...,N(k) for N(k) odd. R is d_BECx<\
% a vector of numbers between 0 and 1. The output Z is a matrix <LIL{g0eX
% with one column for every (N,M) pair, and one row for every Wjn1W;m&g
% element in R. 5m!FtHvm1
% H-~V:OCB~
% Z = ZERNPOL(N,M,R,'norm') returns the normalized Zernike poly- QM=M<~<Voh
% nomials. The normalization factor Nnm = sqrt(2*(n+1)) is `$\g8Mo
% chosen so that the integral of (r * [Znm(r)]^2) from r=0 to XMd-r8yYr
% r=1 is unity. For the non-normalized polynomials, Znm(r=1)=1 acz8
H0cS
% for all [n,m]. UB }n=
% ~Jrtm7
% The radial Zernike polynomials are the radial portion of the xAw$bJj~s
% Zernike functions, which are an orthogonal basis on the unit im_WTZz2P
% circle. The series representation of the radial Zernike U+F?b\
% polynomials is Sg(fZ' -
% iUJqAi1o
% (n-m)/2 eEePK~%c
% __ d!5C$C/x
% m \ s n-2s L}*:,&Y/
% Z(r) = /__ (-1) [(n-s)!/(s!((n-m)/2-s)!((n+m)/2-s)!)] * r j-8v$0'
% n s=0 dR<