Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including zero-crossings with all npm packages installed. Try it out:

var zeroCrossings = require("zero-crossings")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

zero-crossings v1.0.1

Finds all zero crossings in a 1D ndarray

zero-crossings

Finds all zero crossings in a 1D ndarray assuming piecewise-linear interpolation.

Example

var ndarray = require("ndarray")
var zc = require("zero-crossings")

var array = ndarray([1, -1, 0, 10, 3, -1])

console.log(zc(array))

Output:

[ 0.5, 2, 4.75 ]

Install

npm install zero-crossings

API

require("zero-crossings")(array[,level])

Finds all zero crossings in the 1D ndarray array

  • array is a 1D ndarray
  • level is an optional parameter which indicates the crossings

Returns A list of all zero crossings in array

Credits

(c) 2014 Mikola Lysenko. MIT License

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free