diff options
Diffstat (limited to '2048/CH14/EX14.4/kal_ex.sci')
-rwxr-xr-x | 2048/CH14/EX14.4/kal_ex.sci | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/2048/CH14/EX14.4/kal_ex.sci b/2048/CH14/EX14.4/kal_ex.sci new file mode 100755 index 000000000..739e96537 --- /dev/null +++ b/2048/CH14/EX14.4/kal_ex.sci @@ -0,0 +1,12 @@ +// Kalman filter example of estimating a constant
+// 14.4
+
+function [xhat,P,y] = kal_ex(x,xline,M)
+y = x + rand();
+Q = 0; R = 1;
+xhat_ = xline;
+P_ = M + Q;
+K = P_/(P_+R);
+P = (1-K)*P_;
+xhat = xhat_ + K*(y-xhat_);
+endfunction;
|