1.0.1 • Published 7 years ago

fftshift v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

fftshift

Cyclic rotation for phase-zero windowing

npm install fftshift

import { fftshift, ifftshift } from 'fftshift'

// given a signal (an array)
fftshift(signal) // => in-place rotation. 0 is now at the center of the array
ifftshift(signal) // => in-place rotation. Signal is now as before fftshift

Usage

Install via npm:

npm install fftshift

Require in your code:

Example

// ES6 syntax
import { fftshift, ifftshift } from 'fftshift'

// ES5 syntax
var shift = require('fftshift')
shift.fftshift(signal)
shift.ifftshift(signal)

API

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

Returns: Array - the same buffer (with the data rotated)

ParamType
bufferArray

ifftshift(buffer) ⇒ Array

Inverse of zero-phase windowing alignment

CAUTION: this function mutates the array

Kind: static method of fftshift
Returns: Array - the same buffer (with the data rotated)
See: fftshift

ParamType
bufferArray

License

MIT License