Skip to main content

centred_bin

Function centred_bin 

Source
pub fn centred_bin(i: usize, k: usize, n: usize) -> usize
Expand description

The DFT bin of the i-th of k contiguous subcarriers centred on bin 0 (indices -k/2 … k/2 - 1, in increasing frequency) on a grid of n bins: (i - ⌊k/2⌋) mod n.

§Examples

use comnum_math::fft::centred_bin;
// four subcarriers on a grid of eight: bins 6, 7, 0, 1
assert_eq!((0..4).map(|i| centred_bin(i, 4, 8)).collect::<Vec<_>>(), [6, 7, 0, 1]);