function z = zernpol(n,m,r,nflag) (V@g?|LZ
%ZERNPOL Radial Zernike polynomials of order N and frequency M. I_.(&hMn
% Z = ZERNPOL(N,M,R) returns the radial Zernike polynomials of E&V"z^qs_
% order N and frequency M, evaluated at R. N is a vector of 2D`@$)KL
% positive integers (including 0), and M is a vector with the SQ5SvYH
% same number of elements as N. Each element k of M must be a @PuJre4!;L
% positive integer, with possible values M(k) = 0,2,4,...,N(k) $s.:wc^
% for N(k) even, and M(k) = 1,3,5,...,N(k) for N(k) odd. R is )0`;leli
% a vector of numbers between 0 and 1. The output Z is a matrix |J2_2a/"
% with one column for every (N,M) pair, and one row for every !> b>"\b
% element in R. W3*BdpTw
% 7a0ZI
% Z = ZERNPOL(N,M,R,'norm') returns the normalized Zernike poly- [CBA Lj5
% nomials. The normalization factor Nnm = sqrt(2*(n+1)) is c#nFm&}dm
% chosen so that the integral of (r * [Znm(r)]^2) from r=0 to `;WiTE)&)
% r=1 is unity. For the non-normalized polynomials, Znm(r=1)=1 >i~W$;t
% for all [n,m]. /S1EQ%_
% E-_)w
% The radial Zernike polynomials are the radial portion of the /,$;xt-J35
% Zernike functions, which are an orthogonal basis on the unit o%X_V!B{V
% circle. The series representation of the radial Zernike 7CYu"+Ea
% polynomials is Qi2yaEB
% <ro0}%-z>M
% (n-m)/2 1i#uKKwE
% __ NUiZ!&
% m \ s n-2s cyA|6Ltg%
% Z(r) = /__ (-1) [(n-s)!/(s!((n-m)/2-s)!((n+m)/2-s)!)] * r @gENv~m<OI
% n s=0 g 'c4&Do
% YQ X+lE
% The following table shows the first 12 polynomials. K+Q81<X~
% VJBVk8P
% n m Zernike polynomial Normalization xB3;%Lc
% --------------------------------------------- rZ 9bz}K
% 0 0 1 sqrt(2) sp0&"&5
% 1 1 r 2 7!w@u6Q
% 2 0 2*r^2 - 1 sqrt(6) <