Solar powered, with a wireless keyboard and touchpad.
Friday, August 30, 2019
Wednesday, July 17, 2019
Sunday, April 21, 2019
San Juan Islands, WA
Tuesday, March 12, 2019
Easy Low Pass Filter
Instead of implementing a buffer and smooth it, there is a much easier and efficient way to do it.
Here is a simple JavaScript implementation.
First you define your accumulator function:
function lowPass(alpha, value, acc) { return (value * alpha) + (acc * (1 - alpha)); }Then you need to define your
APLHA
coefficient:
const ALPHA = 0.015;Then you can invoke the accumulator with the aplha coefficient on the data to smooth:
let filteredGustArray = []; let acc = 0; data.data.forEach(dp => { acc = lowPass(ALPHA, dp.gust, acc); filteredGustArray.push(acc); });This produces an array containing the smoothed data. Here is a representation of what it looks like, along with the data to smooth (raw data in red, smoothed data in blue): The demo data are available here. Just run the script with
nodejs
like
$ node max.gust.js both > data.csvThis will produce a
csv
file you can then import into any spreadsheet program, to see the figure above.
Monday, March 11, 2019
Smart TCP Watch, prototype.
Subscribe to:
Posts (Atom)