private void powerPhaseFFT(double[] re,double[] im){
  fft(re,im,FFT_FORWARD);
  for (int i=0; i < re.length; i++) {
    double pow=re[i] * re[i] + im[i] * im[i];
    im[i]=Math.atan2(im[i],re[i]);
    re[i]=pow;
  }
}

private void powerPhaseFFT ( double [ ] re , double [ ] im ) { fft ( re , im , FFT_FORWARD ) ; for ( int i = 0 ; i < re . length ; i ++ ) { double pow = re [ i ] * re [ i ] + im [ i ] * im [ i ] ; im [ i ] = Math . atan2 ( im [ i ] , re [ i ] ) ; re [ i ] = pow ; } }
computes a complex ( or real if im [ ] = = { 0 , . . . } ) fft and converts the results to polar coordinates ( power and phase ) . both arrays must be the same length , which is a power of 2 .
