@jsh/filter
Since v8.0.52Avg
Usage example
|
|
MovAvg
Usage example
|
|
Lowpass
Usage example
|
|
Kalman
Usage example
|
|
KalmanSmoother
Usage example
|
|
Kalman Filter vs. Smoother
SCRIPT("js", {
const { now } = require("@jsh/system");
const { arrange, Simplex } = require("@jsh/generator");
const m = require("@jsh/filter")
const simplex = new Simplex(1234);
const kalmanFilter = new m.Kalman(0.1, 0.001, 1.0);
const kalmanSmoother = new m.KalmanSmoother(0.1, 0.001, 1.0);
const real = 14.4;
}, {
s_x = []; s_values = []; s_filter = []; s_smooth = [];
for( x of arrange(0, 10, 0.1)) {
x = Math.round(x*100)/100;
measure = real + simplex.eval(x) * 4;
s_x.push(x);
s_values.push(measure);
s_filter.push(kalmanFilter.eval(now(), measure));
s_smooth.push(kalmanSmoother.eval(now(), measure));
}
$.yield({
title:{text:"Kalman filter vs. smoother"},
xAxis:{type:"category", data:s_x},
yAxis:{ min:10, max: 18 },
series:[
{type:"line", data:s_values, name:"values"},
{type:"line", data:s_filter, name:"filter"},
{type:"line", data:s_smooth, name:"smoother"}
],
tooltip: {show: true, trigger:"axis"},
legend: { bottom: 10},
animation: false
});
})
CHART(size("600px", "400px"))

Last updated on