📄 zern_rcoeff.pro
字号:
; $Id: zern_rcoeff.pro,v 1.1.1.1 2002/03/12 11:53:46 riccardi Exp $
;
; A. Riccardi, Dipartimento di Astronomia di Firenze (Italy).
; e-mail address: riccardi@arcetri.astro.it
; Please, send me a message if you modify this code.
function zern_rcoeff, n, m, DOUBLE=is_double
;+
; NAME:
; ZERN_RCOEFF
;
; PURPOSE:
; ZERN_COEFF returns the vector of (n-m)/2+1 coefficients of Zernike
; radial polynomial with radial degree n and azimuthal
; frequency m. The first elements corrispond to higher order (n), the last
; to lower order (m).
;
; CATEGORY:
; Special polynomial
;
; CALLING SEQUENCE:
;
; Result = ZERNKE_RCOEFF(N, M)
;
; INPUTS:
; N: radial degree, integer, N >= 0
; M: azimuthal frequency, integer 0 <= M <= N and M-N even
;
; KEYWORDS:
; DOUBLE: set if Result must be double
;
; OUTPUTS:
;
; EXAMPLE:
;
; MODIFICATION HISTORY:
; Written by: A. Riccardi, 1995/05/09.
;-
if n lt 0 then begin
print, 'zern_rcoeff -- must have n>=0'
return, 0.
endif
if m lt 0 or m gt n or not is_even(n-m) then begin
print, 'zern_rcoeff -- must have 0<=m<=n and n-m even'
return, 0.
endif
npm2 = (n+m)/2
nmm2 = (n-m)/2
if keyword_set(is_double) then coeff=dblarr(nmm2+1) else coeff=fltarr(nmm2+1)
; calculate the coefficient of highest order of the radial polynomial
coeff(0) = 1
temp=npm2+1
for i=1,nmm2 do begin
coeff(0) = coeff(0)/i*temp
temp = temp+1
endfor
; evaluate the polynomial
for s=0,nmm2-1 do begin
; calculate the coefficient of lower order
coeff(s+1) = -coeff(s)/(n-s)*(npm2-s)/(s+1)*(nmm2-s)
endfor
return, coeff
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -