Created
December 2, 2016 17:30
-
-
Save adamabernathy/8cce9986f9e8259df937d3c3693f21fc to your computer and use it in GitHub Desktop.
Creates a linearly spaced array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a linearly spaced array | |
* | |
* @param {number} start - starting integer | |
* @param {number} nvalues - how many values | |
* @param {number} interval - interval (optional) | |
*/ | |
function __linspace(start, nvalues, interval) { | |
if (typeof interval === "undefined") { interval = 0; } | |
var i; | |
var r = []; | |
for (i = 0; i < nvalues; i++) { | |
r.push(start + (i * interval)); | |
} | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment