@*****************************************************@ @ czt.gss - supplementary program to @ @ @ @ "Introduction to FFT in Finance" @ @ @ @ (c) 2004 Ales Cerny, all rights reserved @ @*****************************************************@ /* procedure czt implements the chirp-z transform for short output lengths */ proc czt(x,m,w,A); local n,nnew,b,fa,fb,chirp; n=rows(x); if m > n; print "choose m lower than or equal to the dimension of input vector"; retp(); else; nnew=optn(n); chirp=A*w^(-seqa(0,1,n)^2/2); b=chirp|zeros(2*nnew-2*n+1,1)|rev(chirp[2:n]); fb=ffti(b^-1); fa=ffti((x.*chirp)|zeros(2*nnew-n,1)); b=fftn(fa.*fb); retp(chirp[1:m].*b[1:m]); endif; endp;