搬砖到此:

A Quick Insight    

As I mentioned earlier, it's nearly impossible to grasp the full meaning of Kalman Filter by starting from definitions and complicated equations (at least for us mere mortals). For most cases, the state matrices drop out and we obtain the below equation, which is much easier to start with.

Remember, the k's on the subscript are states. Here we can treat it as discrete time intervals, such as k=1 means 1ms, k=2 means 2ms.

Our purpose is to find , the estimate of the signal x. And we wish to find it for each consequent k's.

Also here, is the measurement value. Keep in mind that, we are not perfectly sure of these values. Otherwise, we won't be needing to do all these. And is called "Kalman Gain" (which is the key point of all these), and is the estimate of the signal on the previous state.

The only unknown component in this equation is the Kalman Gain . Because, we have the measurement values, and we already have the previous estimated signal. You should calculate this Kalman Gain for each consequent state. This is not easy of course, but we have all the tools to do it.

On the other hand, let's assume to be 0.5, what do we get? It's a simple averaging! In other words, we should find smarter coefficients at each state. The bottom line is :

Kalman filter finds the most optimum averaging factor for each consequent state. Also somehow remembers a little bit about the past states.

Isn't this amazing?

Step-by-Step Guide    

Here's a simple step-by-step guide for a quick start to Kalman filtering.

STEP 1 - Build a Model    

It's the most important step. First of all, you must be sure that, Kalman filtering conditions fit to your problem.

As we remember the two equations of Kalman Filter is as follows:

It means that each xk  (our signal values) may be evaluated by using a linear stochastic equation (the first one). Any xk is a linear combination of its previous value plus a control signal uk and a process noise (which may be hard to conceptualize). Remember that, most of the time, there's no control signal uk.

The second equation tells that any measurement value (which we are not sure its accuracy) is a linear combination of the signal value and the measurement noise. They are both considered to be Gaussian.

The process noise and measurement noise are statistically independent.

The entities A, B and H are in general form matrices. But in most of our signal processing problems, we use models such that these entities are just numeric values. Also as an additional ease, while these values may change between states, most of the time, we can assume that they're constant.

If we are pretty sure that our system fits into this model (most of the systems do by the way), the only thing left is to estimate the mean and standard deviation of the noise functions Wk-1 and vk. We know that, in real life, no signal is pure Gaussian, but we may assume it with some approximation. This is not a big problem, because we'll see that the Kalman Filtering Algorithm tries to converge into correct estimations, even if the Gaussian noise parameters are poorly estimated.

The only thing to keep in mind is : "The better you estimate the noise parameters, the better estimates you get."

STEP 2 - Start the Process    

If you succeeded to fit your model into Kalman Filter, than the next step is to determine the necessary parameters and your initial values.

We have two distinct set of equations : Time Update (prediction) and Measurement Update (correction). Both equation sets are applied at each kth state.

Time Update
(prediction)
Measurement Update
(correction)

We made the modeling in STEP1, so we know the matrices A, B and H. Most probably, they will be numerical constants. And even most probably, they'll be  equal to 1. I suggest you to re-write these equations and see how simplified will these equations become. (if you're lazy enough not to do it, I'll do it for you in the Example below).

The most remaining painful thing is to determine R and Q. R is rather simple to find out, because, in general, we're quite sure about the noise in the environment. But finding out Q is not so obvious. And at this stage, I can't give you a specific method.

To start the process, we need to know the estimate of x0, and P0.

STEP 3 - Iterate

   

After we gathered all the information we need and started the
process, now we can iterate through the estimates. Keep in mind that the
previous estimates will be the input for the current state.

Here, is the "prior estimate" which in a way, means the rough estimate before the measurement update correction. And also  is the "prior error covariance". We use these "prior" values in our Measurement Update equations.

In Measurement Update equations, we really find which is the estimate of x at time k (the very thing we wish to find). Also, we find which is necessary for the k 1 (future) estimate, together with . The Kalman Gain ()
we evaluate is not needed for the next iteration step, it's a hidden,
mysterious and the most important part of this set of equations.

The values we evaluate at Measurement Update stage are also called "posterior" values. Which also makes sense.

Answers to Silly Questions

 

Can I deploy Kalman Filter to all Digital Signal Processing problems?

I've
seen lots of papers that use Kalman Filter for a variety of problems,
such as noise filtering, sub-space signal analysis, feature extraction
and so on. The bottom line is, you can use Kalman Filter with a quite
approximation and clever modeling.

Can I use it for Image Processing?

Of course.

Where do we find these Time Update and Measurement Update equations? It seems that they suddenly appeared from nowhere.

You can derive it from the linear stochastic difference equation (the equations in STEP 1), by taking the partial derivative and setting them to zero (for minimizing the estimation error). Of course they're hard and time consuming.

  Rudolf Emil Kalman

 
 

Rudolf Kalman was born in Budapest, Hungary, and
obtained his bachelor's degree in 1953 and master's degree in 1954 from
MIT in electrical engineering. His doctorate in 1957 was from Columbia
University.

Kalman is an electrical engineer by training, and is famous for his co-invention of the
Kalman filter, a mathematical technique widely used in control systems and avionics to extract a
signal from a series of incomplete and noisy measurements.

Kalman's ideas on filtering were initially met with skepticism, so much so that he was
forced to first publish his results in a mechanical (rather than electrical) engineering journal.

He had more success in presenting his ideas, however, while visiting Stanley F. Schmidt at the
NASA Ames Research Center in 1960. This led to the use of Kalman filters during the Apollo program.

 
A Simple Example

   

Now let's try to estimate a scalar random constant, such as a "voltage reading" from a source. So let's assume that it has a constant value of aV (volts) , but of of course we some noisy readings above and below a volts. And we assume that the standard deviation of the measurement noise is 0.1 V.

Now let's build our model:

As I promised earlier, we reduced the equations to a very simple form.

• Above all, we have a 1 dimensional signal problem, so every entity in our model is a numerical value, not a matrix.

• We have no such control signal uk, and it's out of the game

• As the signal is a constant value, the constant A
is just 1, because we already know that the next value will be same as
the previous one. We are lucky that we have a constant value in this
example, but even if it were any other linear nature, again we could
easily assume that the value A will be 1.

• The value H = 1, because we know that the
measurement is composed of the state value and some noise. You'll rarely
encounter real life cases that H is different from 1.

And finally, let's assume that we have the following measurement values:

TIME
(ms)
1 2 3 4 5 6 7 8 9 10
VALUE
(V)
0.39 0.50 0.48 0.29 0.25 0.32 0.34 0.48 0.41 0.45

OK, we should start from somewhere, such as k=0. We should find or assume some initial state. Here, we throw out some initial values. Let's assume estimate of X0 = 0, and P0 = 1. Then why didn't we choose P0
= 0 for example? It's simple. If we chose that way, this would mean
that there's no noise in the environment, and this assumption would lead
all the consequent to be zero(remaining as the initial state). So we choose P0 something other that zero.

Let's write the Time Update and Measurement Update equations.

Time Update
(prediction)
Measurement Update
(correction)

Now, let's calculate the values for each iteration.

k 1 2 3 4 5 6 7 8 9 10
0.390 0.500 0.480 0.290 0.250 0.320 0.340 0.480 0.410 0.450
0 0.355 0.424 0.442 0.405 0.375 0.365 0.362 0.377 0.380
1 0.091 0.048 0.032 0.024 0.020 0.016 0.014 0.012 0.011


Time
Update

= = 0
= = 1
= 0.355
= 0.091
               
Measurement
Update

= 1 / (1 0.1)
= 0.909

= 0 0.909 (0.390 - 0)
= 0.35

= (1 - 0.909) . 1
= 0.091

= 0.091 / (0.091 0.1)
= 0.476

= 0.355 0.476 (0.500 - 0.355)
= 0.424

= (1 - 0.476) . 0.091
= 0.048

               
0.355 0.424 0.442 0.405 0.375 0.365 0.362 0.377 0.380 0.387
0.091 0.048 0.032 0.024 0.020 0.016 0.014 0.012 0.011 0.010

Here, I displayed the first 2 state iterations in detail,
the others follow the same pattern. I've completed the other numerical
values via a computer algorithm, which is the appropriate solution. If
you try to write it as an algorithm, you'll discover that Kalman Filter is very easy to implement.

The chart here (right) shows that the Kalman Filter
algorithm converges to the true voltage value. Here, I displayed the
first 10 iterations and we clearly see the signs of convergence. In 50
or so iterations, it'll converge even better.

To enable the convergence in fewer steps, you should

• Model the system more elegantly
• Estimate the noise more precisely

OK. We're done. The only thing to do is collecting the values we've calculated. That's it!

The Kalman Filter algorithm converges to the truth over a few iterations

 
References

   

[1] Greg Welch, Gary Bishop, "An Introduction to the Kalman Filter",  University of North Carolina at Chapel Hill Department of Computer Science, 2001

[2] M.S.Grewal, A.P. Andrews, "Kalman Filtering - Theory and Practice Using MATLAB", Wiley, 2001

卡尔曼滤波器【Kalman Filter For Dummies】的更多相关文章

  1. 卡尔曼滤波器 Kalman Filter (转载)

    在学习卡尔曼滤波器之前,首先看看为什么叫“卡尔曼”.跟其他著名的理论(例如傅立叶变换,泰勒级数等等)一样,卡尔曼也是一个人的名字,而跟他们不同的是,他是个现代人! 卡 尔曼全名Rudolf Emil ...

  2. 测试卡尔曼滤波器(Kalman Filter)

    真实的温度测试数据,通过加热棒加热一盆水测得的真实数据,X轴是时间秒,Y轴是温度: 1)滤波前 2)滤波后(p=10, q=0.0001, r=0.05, kGain=0;) 2)滤波后(p=10, ...

  3. [转载]卡尔曼滤波器及其基于opencv的实现

    卡尔曼滤波器及其基于opencv的实现 源地址:http://hi.baidu.com/superkiki1989/item/029f65013a128cd91ff0461b 这个是维基百科中的链接, ...

  4. 时间序列八: 以NASA之名: 卡尔曼滤波器

    目录 以NASA之名: 卡尔曼滤波器 引言 荣耀骑士 卡尔曼滤波器* 参考文献: 以NASA之名: 卡尔曼滤波器 'That's one small step for man,one giant le ...

  5. kalman filter卡尔曼滤波器- 数学推导和原理理解-----网上讲的比较好的kalman filter和整理、将预测值和观测值融和

    = 参考/转自: 1 ---https://blog.csdn.net/u010720661/article/details/63253509 2----http://www.bzarg.com/p/ ...

  6. [Math]理解卡尔曼滤波器 (Understanding Kalman Filter) zz

    1. 卡尔曼滤波器介绍 卡尔曼滤波器的介绍, 见 Wiki 这篇文章主要是翻译了 Understanding the Basis of the Kalman Filter Via a Simple a ...

  7. [Math]理解卡尔曼滤波器 (Understanding Kalman Filter)

    1. 卡尔曼滤波器介绍 卡尔曼滤波器的介绍, 见 Wiki 这篇文章主要是翻译了 Understanding the Basis of the Kalman Filter Via a Simple a ...

  8. 对Kalman(卡尔曼)滤波器的理解

    1.简单介绍(Brief Introduction) 在学习卡尔曼滤波器之前,首先看看为什么叫"卡尔曼". 跟其它著名的理论(比如傅立叶变换.泰勒级数等等)一样.卡尔曼也是一个人的 ...

  9. 对Kalman(卡尔曼)滤波器的理解@@zz

    1.简介(Brief Introduction) 在学习卡尔曼滤波器之前,首先看看为什么叫“卡尔曼”.跟其他著名的理论(例如傅立叶变换,泰勒级数等等)一样,卡尔曼也是一个人的名字,而跟他们不同的是,他 ...

随机推荐

  1. jquery bind()方法与live()方法的区别

    jquery bind() 方法和 live() 方法都可以绑定元素事件. <!DOCTYPE html> <html> <head> <meta chars ...

  2. [模拟]ZOJ3480 Duck Typing

    题意:给了一坨...按题目意思输出就好了... 给一组案例 begin class d class c:d class b:c class a:b def d.m def d.n call a.m e ...

  3. Magento学习

    Magento是一个php电子商务系统. 内部模块化. 创建模块流程 Magento系统模块 app/code/core/Mage 其中每一个子目录都是一个单独的模块 自己创建的模块放在下面路径 ap ...

  4. swap chain- IDirect3DSwapChain9

    交换链,对应的接口是IDirect3DSwapChain9,是整个Directx 3D中最核心的接口.D3d程序至少包含一个swap chain,在调用CreateDevice时自动创建, 其中的D3 ...

  5. Razor视图引擎的基本概念与法语

    Razor 视图引擎的特点: 简洁.富于表现.流畅 尽量减少页面代码的输入,实现快速流畅的编程工作 不必明确为服务器代码标记起始与结束符,Razor 能智能判断,这样让页面看清洁,代码方便阅读 asp ...

  6. HDU1312——Red and Black(DFS)

    Red and Black Problem DescriptionThere is a rectangular room, covered with square tiles. Each tile i ...

  7. linux系统的crond服务

    linux系统中有一个服务,用来做周期性运行的例行任务,这个服务就是crond服务.执行这项服务的命令 就是crontab命令了.而linux下的任务调度又分为系统任务调度和用户任务调度两个大类. 系 ...

  8. android的休眠和唤醒流程

    android休眠唤醒流程: power按键事件上报给android系统,最终由windownmanager接收到,当有按键事件时判断是否需要休眠后唤醒系统,然后调用powermanager系统服务去 ...

  9. JSON格式转换成XML格式

    第一种方法: 需要使用命名空间System.Runtime.Serialization.Json 下面有JsonReaderWriterFactory XmlDictionaryReader read ...

  10. 微软嵌入式WEC2013产品研讨会(深圳站---2013.10.16)

    主要内容如下: 1.      Windows Embedded Compact 2013面向的市场 主要面向工业自动化.医疗设备和零售行业这些市场,和物联网关系非常紧密. 2.      Windo ...