function WWPLOC, d,b,k,qmf,n ;+ ; NAME: ; WWPLOC ; ; PURPOSE: ; This function calculates location of wavelet packet entry. ; ; CATEGORY: ; Wavelets. ; ; CALLING SEQUENCE: ; ; pos = WWPLOC(d,b,k,qmf,n) ; ; INPUTS: ; d = depth index ; b = block index ; k = coef index ; qmf = qmf filter ; n = signal length ; ; OUTPUTS: ; pos = position in wp data structure ; ; MODIFICATION HISTORY: ; Written by: Amara Graps November, 1995 ;Translated from MatLab Wavelab routine: calcwplocation.m ;- wp = FLTARR(d+1, n) wp = WPIPULSE(wp,d,b,k,qmf) w = TRANSPOSE( wp(0, *)) ;use the IDL way to create an index array aa = 1 ;1st value bb = 1 ;increment cc = n;last value indx_arr = WMKIARRY( aa, bb, cc) pr = w^2 / WSUM(w^2) t = 2*!pi * (indx_arr) / FLTARR(n) x = WSUM(COS(t) * pr) y = WSUM(SIN(t) * pr) CASE 1 OF ;1 = true (WNNORM([x,y]) LT 1.0E-6): pos = n/2 ELSE: pos = (ATAN(-y,-x) + !pi) / (2*!pi) * n ENDCASE ; ; Algorithm Source: WaveLab Version 0.600 ; WaveLab WWW site: http://playfair.stanford.edu/ ; WaveLab Questions? e-mail wavelab@playfair.stanford.edu ; RETURN, pos END ;***************************************************