fftshift

Function fftshift 

Source
pub fn fftshift<F, D>(x: &Array<F, D>) -> FFTResult<Array<F, D>>
where F: Copy + Debug, D: Dimension,
Expand description

Shift the zero-frequency component to the center of the spectrum.

§Arguments

  • x - Input array

§Returns

The shifted array with the zero-frequency component at the center.

§Examples

use scirs2_fft::fftshift;
use scirs2_core::ndarray::Array1;

let x = Array1::from_vec(vec![0.0, 1.0, 2.0, 3.0]);
let shifted = fftshift(&x).unwrap();
assert_eq!(shifted, Array1::from_vec(vec![2.0, 3.0, 0.0, 1.0]));