JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q34143F
  • License MIT

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (w-fft) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    w-fft

    A tool for FFT.

    language npm version license npm download npm download jsdelivr download

    Documentation

    To view documentation or get support, visit docs.

    Example

    To view some examples for more understanding, visit examples:

    spectrum1d: ex-spectrum1d.html [source code]

    Installation

    Using npm(ES6 module):

    Note: w-fft is mainly dependent on ml-fft, lodash-es and wsemi.

    npm i w-fft

    Example for FFT1D and iFFT1D:

    Link: [dev source code]

    
    let arr
    let res
    
    arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
    res = wf.fft1d(arr)
    console.log(res)
    // => [
    //   [ 120, 0 ],
    //   [ -8, 40.21871593700678 ],
    //   [ -8, 19.31370849898476 ],
    //   [ -7.999999999999999, 11.972846101323913 ],
    //   [ -8, 8 ],
    //   [ -8, 5.345429103354391 ],
    //   [ -8, 3.313708498984761 ],
    //   [ -7.999999999999999, 1.5912989390372623 ],
    //   [ -8, 0 ],
    //   [ -7.999999999999999, -1.5912989390372623 ],
    //   [ -8, -3.313708498984761 ],
    //   [ -8, -5.345429103354391 ],
    //   [ -8, -8 ],
    //   [ -7.999999999999999, -11.972846101323913 ],
    //   [ -8, -19.31370849898476 ],
    //   [ -8, -40.21871593700678 ]
    // ]
    
    arr = [
        [120, 0],
        [-8, 40.21871593700678],
        [-8, 19.31370849898476],
        [-7.999999999999999, 11.972846101323913],
        [-8, 8],
        [-8, 5.345429103354391],
        [-8, 3.313708498984761],
        [-7.999999999999999, 1.5912989390372623],
        [-8, 0],
        [-7.999999999999999, -1.5912989390372623],
        [-8, -3.313708498984761],
        [-8, -5.345429103354391],
        [-8, -8],
        [-7.999999999999999, -11.972846101323913],
        [-8, -19.31370849898476],
        [-8, -40.21871593700678]
    ]
    res = wf.ifft1d(arr)
    console.log(res)
    // => [
    //    0,                  1,
    //    2, 3.0000000000000018,
    //    4,  5.000000000000002,
    //    6,                  7,
    //    8,                  9,
    //   10, 10.999999999999998,
    //   12, 12.999999999999998,
    //   14,                 15
    // ]
    

    In a browser(UMD module):

    Note: w-fft does not dependent on any package.

    Add script for w-fft.

    <script src="https://cdn.jsdelivr.net/npm/w-fft@1.0.7/dist/w-fft.umd.js"></script>