fftshift

Cyclic rotation for phase-zero windowing

npm install dsp-fftshift

This is part of dsp-kit

Source:
Examples
var shift = require('dsp-fftshift')
shift.fftshift(signal)
shift.ifftshift(signal)
// ES6 syntax
import { fftshift, ifftshift } from 'dsp-fftshift'
fftshift(signal)
// included in dsp-kit package
var dsp = require('dsp-kit')
dsp.fftshift(signal)
dsp.ifftshift(signal)

Methods

(static) fftshift(buffer) → {Array}

Zero-phase windowing alignment

CAUTION: this function mutates the array

Perform a cyclic shifting (rotation) to set the first sample at the middle of the buffer (it reorder buffer samples from (0:N-1) to [(N/2:N-1) (0:(N/2-1))])

Named by the same function in mathlab: fftshift

Parameters:
Name Type Description
buffer Array
Source:
Returns:

the same buffer (with the data rotated)

Type
Array

(static) ifftshift(buffer) → {Array}

Inverse of zero-phase windowing alignment

CAUTION: this function mutates the array

Parameters:
Name Type Description
buffer Array
Source:
See:
  • fftshift
Returns:

the same buffer (with the data rotated)

Type
Array