MAVGCL/src/main/java/com/comino/analysis/FourierTransform.java
/**
   * Returns the index of the frequency band that contains the requested
   * frequency.
   * 
   * @param freq
   *          the frequency you want the index for (in Hz)
   * @return the index of the frequency band that contains freq
   */
Returns the index of the frequency band that contains the requested
frequency.

@param freq
the frequency you want the index for (in Hz)
@return the index of the frequency band that contains freq
Returns the index of the frequency band that contains the requested frequency . @param freq the frequency you want the index for ( in Hz ) @return the index of the frequency band that contains freq
public int freqToIndex(float freq)
  {
    if (freq < getBandWidth() / 2) return 0;
    if (freq > sampleRate / 2 - getBandWidth() / 2) return spectrum.length - 1;
    float fraction = freq / (float) sampleRate;
    int i = Math.round(timeSize * fraction);
    return i;
  }
public int freqToIndex ( float freq ) { if ( freq < getBandWidth ( ) / 2 ) return 0 ; if ( freq > sampleRate / 2 - getBandWidth ( ) / 2 ) return spectrum . length - 1 ; float fraction = freq / ( float ) sampleRate ; int i = Math . round ( timeSize * fraction ) ; return i ; }
Returns the index of the frequency band that contains the requested
 frequency.
Returns the index of the frequency band that contains the requested frequency .
// special case: freq is lower than the bandwidth of spectrum[0]
 // special case: freq is within the bandwidth of spectrum[spectrum.length - 1]
 // all other cases
