fftshift
v1.0.1
Published
Cyclic rotation for phase-zero windowing
Downloads
207
Maintainers
Readme
fftshift
Cyclic rotation for phase-zero windowing
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)
| Param | Type | | --- | --- | | buffer | Array |
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
| Param | Type | | --- | --- | | buffer | Array |
License
MIT License