Skip to main content
. 2019 Mar 7;19(5):1168. doi: 10.3390/s19051168
Algorithm 1 Kalman filtering using the recommended measurement noise variance.
Input:
      S[1:length]: a numeric sequence of sensor data;
      fR(): a function for a measurement noise variance recommendation;
      w: a window size used for computing the measurement noise variance;
Output:
      S[1:length]: a filtered sequence by the Kalman Filter;
begin
      (1) i:=1
      (2) S[1:w]:=S[1:w];                   // Use the first w entries of S for S as it is.
      (3) while i+w1length do
      (4)       R:=fR(S[i:i+w1]);     // Determine R by using the w entries.
      (5)       i:=i+w;                              // Increase i by w.
      (6)       S[i:i+w1]:= KalmanFilter(S[i:i+w1],R);
                 // Adjust the next w entries by applying R to the Kalman filter.
      (7) end
      (8) return S[1:length];
end