当前位置:网站首页>From Bayesian filter to Kalman filter (zero)
From Bayesian filter to Kalman filter (zero)
2022-07-28 19:09:00 【Learn something】
What is filtering ?
Whether it is the data inferred from the established model equation , Or use the data directly measured by the sensor , It's not always an ideal fitting curve , There are always deviations 、 variance , And filtering is to reduce these variances as much as possible , Reduce noise interference , So that the final data is closer to the real value —— That is, the variance tends to 0. therefore , Filtering is reducing variance .
How to understand that every moment is a random variable ?
We know , We need to take samples , There is a sampling interval , In fact, we cannot determine the value of each sampling point , It can only be regarded as a random variable
The simple principle of Bayesian filtering ?
Subjective probability + External observation = Relatively objective probability
Subjective probability : People's subjective guesses or people based on certain knowledge 、 Empirical equations and models , Used to predict the next data value
External observation : Data measured with actual sensors
Relatively objective probability : For subjective probability , Always seem unsure , The variance is relatively large ( After all, it's speculation ), When there is a reference to external observations , People will combine these external observations to correct the previous subjective probability , So it seems relatively objective
such as : In the stock market , At first , Subjectively think that the stock market of a is good , Think it will soar next . This is the initial subjective judgment , There is no external observation 、 Subjective judgment before the experiment . But next , I learned from the news , A stock owner ran away , That is, with external observation 、 experiment , Then it's time to correct the previous subjective judgment , Corrected , I think the stock of a is likely to fall next . This becomes a relatively objective judgment . In fact, the above is the fusion of subjective judgment and external observation information , So as to get a more comprehensive and objective result ; Or use external observation ( Additional information ) To correct your initial subjective judgment , So that the model 、 The judgment is closer to the real situation .
The value of each moment is a random variable , Whether there is a connection between these random variables ?
Existing connection , You can do recursion , But you need to guess the specific recursive relationship yourself 、 To fit , in other words , Based on the truth value of the previous time and the established recursive relationship , It is easy to infer the value of the current moment . This recursive relationship between the current time value and the previous time value is called the equation of state —— seeing the name of a thing one thinks of its function , The reaction is at different times / The relationship between States , So as to realize recursion and prediction . But apparently , There must be errors in recurrence ( variance ) Of , After all, there is no equation 、 The model can be said to be 100% accurate , Because it's hard for you to find this equation that fits these data perfectly , It's impossible to guess so accurately , Unless you know in advance the equation of the signal you want to measure .
for example , Recurrence relation ( among Q It's a noise signal , Normally distributed noise )

Whether there is a certain relationship between the true value and the value measured by the sensor ?
There can be . Think so , If a sensor has high measurement accuracy, there is no error , Then each measured value = Truth value , This is the functional relationship between them . however , There are usually errors , And the units of your observations and measurements are not necessarily the same , Therefore, it is necessary to use relational expression to describe the relationship between —— The equation used to describe the relationship between the observed value and the true value is called the observation equation . obviously , Here, the truth value can be inversely evaluated through the observation value and observation equation , however , The result of this reverse calculation must have errors , After all, the data you observe are actually inaccurate ( Sensor accuracy leads to ).
for example , The observation equation (R It's noise 、 error )

Why introduce the equation of state and observation equation ?
Through the equation of state , Once we know the initial value x0, Then we can use the equation of state to predict the next true value x1, x2, x3...... wait
By observing the equation , Plus the data measured by the sensor , We can reverse the truth value x1, x2, x3...... wait
however , Which of these two do you want to believe ? The answer is , I want all of them. —— Fuse the data of the two , Reduce variance and uncertainty , So as to get a more accurate value , Closer to the truth
This initial value x0 How did you get ? What do you usually need to know about the initial value ?
initial value x0 In fact, it can be determined arbitrarily , Because even if the initial value is outrageous at first , But because there are observations to correct , So it will be corrected to the normal level soon
About the initial value , We need to understand , The value of each moment is actually a random variable , Since it is a random variable , Then there will be mean and variance , therefore , Requirements for initial values : You need to know the mean value of the initial value ( In fact, the mean value can be regarded as the true value , After all, the mean value is actually the weighted result after considering the probability of various situations , Equivalent to the optimal result ) And variance . alike , This variance is also set by oneself , If you feel confident about your average , Then the variance can be reduced ; On the contrary, it is a little bigger . Small variance , The explanation is quite believable , Then the average value accounts for a larger proportion in the fusion result .
Why does the initial value need to know the variance ?
This depends on the equation of state ( That is, the recursive relationship between each random variable ). Or is it because the model can't predict the value completely accurately . Actually , Here we can regard the model as a “ Measuring instrument ”—— It infers the next result from the previous result . Since it is “ Measuring instrument ”, There must be measurement error , This measurement error is described by variance , Knowing this variance is actually equivalent to knowing its probability distribution ( For normal distribution , Most of them are normal distribution )
The additional variance at each time in the equation of state Q Are they the same? ,“ Accuracy of measuring instruments ” It should remain unchanged ?
Actually, that's because Q For the covariance matrix when there are multiple state values , It describes the noise variance corresponding to each state value , And the noise between different state values is uncorrelated, that is, the covariance is 0, Only yourself and your covariance ( Variance ) Not for 0 And it remains the same , thus , actually Q It's a diagonal matrix . for example , Suppose we have two states —— Displacement and velocity , So how to write the equation of state ?( Coefficients and variances are randomly selected , Just to illustrate )
Mean recurrence :

Recurrence between variances (p Variance ):

In fact, it is the equation of state in modern control theory , Generally, the mean and variance are treated separately
The variance added at each time in the observation equation R Are they the same? ,“ The measuring accuracy of the instrument ” It should remain unchanged ?
Yes , and Q The matrix is similar to ,R A matrix is also a diagonal matrix , It's a covariance matrix , The measurement error for a certain state type value remains unchanged
Let's write this first , I don't think I'm clear enough , We need to take a closer look . Especially Bayesian derivation , It's a little complicated. , But once the Bayesian formula is clear , Kalman filter should soon understand
边栏推荐
- If you want to change to it, does it really matter if you don't have a major?
- Can zero basis software testing work?
- 11 年膨胀 575 倍,微信为何从“小而美”变成了“大而肥”?
- Kali doesn't have an eth0 network card? What if you don't connect to the Internet
- kotlin:out in
- SwiftUI Swift 之正向地理编码与反向地理编码(教程含源码)
- 优麒麟系统安装BeyondComare
- What if svchost.exe of win11 system has been downloading?
- CTR click through rate prediction practice project of advertising recommendation!
- When the new version of easycvr is linked at the same level, the subordinate platform passes up the cause analysis of the incomplete display of the hierarchical directory
猜你喜欢

CTR click through rate prediction practice project of advertising recommendation!

SwiftUI 组件之如何实现电话号码掩码隐藏部分的文本字段TextField(教程含源码)

11 年膨胀 575 倍,微信为何从“小而美”变成了“大而肥”?

N32 replaces STM32. Don't ignore these details!

Introduction and advanced level of MySQL (I)

kotlin:Nothing

Use the self-developed proxy server to solve the cross domain access errors encountered when uploading files by SAP ui5 fileuploader trial version

Special Lecture 6 tree DP learning experience (long-term update)

Win11系统svchost.exe一直在下载怎么办?

Kali doesn't have an eth0 network card? What if you don't connect to the Internet
随机推荐
Open source database innovation in the era of digital economy | the 2022 open atom global open source summit database sub forum was successfully held
Example of observer mode of C -- ordering milk
QT with line encoding output cout
BM16 删除有序链表中重复的元素-II
N32替换STM32,这些细节别忽略!
【物理应用】大气吸收损耗附matlab代码
直播平台软件开发,js实现按照首字母排序
Is there any prospect and way out for software testing?
JVM four reference types
How to write a JMeter script common to the test team
EasyCVR设备离线后无法再次上线该如何解决?
Decimal to binary advanced version (can convert negative numbers and boundary values)
行业落地呈现新进展 | 2022开放原子全球开源峰会OpenAtom OpenHarmony分论坛圆满召开
[GXYCTF2019]StrongestMind
If you want to learn software testing, where can you learn zero foundation?
6-20漏洞利用-proftpd测试
Configuration tutorial: how does the organizational structure of the new version of easycvr (v2.5.0) cascade to the superior platform?
How to solve the problem that easycvr device cannot be online again after offline?
QT user defined control user guide (flying Qingyun)
零知识证明:具有DDH假设的 ZKP