File Exchange Pick of the Week

Our best user submissions

Learning the (Linear) Kalman Filter

Brett's Pick this week is"Learning the Kalman Filter", by迈克尔Kleder.

如果要按照过去30天的下载次数对文件交换的条目进行排序,那么有趣的趋势将变得显而易见:少数文件的下载次数远远超过了绝大多数文件的次数。找的零钱。其中,特别是一个文件的销量比下一个最受欢迎的文件多43%。

The popularity of Michael's "Learning the Kalman Filter" mini tutorial (as of this writing, it has been downloaded 2803 times in the past 30 days--even though the file has been up for 6 years!), along with the great feedback it has garnered (73 comments and 67 ratings, averaging 4.5 out of 5 stars), initially caught my eye.

Michael wrote in the preamble to his tutorial:

%%%%%%%%%%%%%%%%%%%

许多人听说过卡尔曼过滤,但认为这个话题是神秘的。虽然确实是在多种情况下得出Kalman过滤器并在数学上证明它是“最佳”可能是相当激烈的,但将过滤器应用于基本的线性系统实际上非常容易。此MATLAB文件旨在证明这一点。

%%%%%%%%%%%%%%%%%%%

In his in-file example, Michael then steps through a Kalman filter example in which a voltmeter is used to measure the output of a 12-volt automobile battery. The model simulates both randomness in the output of the battery, and error in the voltmeter readings. Then, even without defining an initial state for the true battery voltage, Michael demonstrates that with only 5 lines of code, the Kalman filter can be implemented to predict the true output based on (not-necessarily-accurate) uniformly spaced, measurements:

This is a simple but powerful example that shows the utility and potential of Kalman filters. It's sure to help those who are trepid about delving into the world of Kalman filtering.

A couple notes on Michael's implementation... First, note that the返回statement at the end of his function is extraneous. But perhaps this code was culled from a larger file in which that command served some purpose? Also, as one commenter noted, and as the MLINT Code Analyzer points out, inv(A)*B is better written as A\B. There's a similar suggested substitution for A*Inv(B), both of which can be rendered faster and more accurate using thebackslash(矩阵左部)操作员。

评论?.




Published with MATLAB® 7.11

|
  • print
  • send email

评论

To leave a comment, please click这里to sign in to your MathWorks Account or create a new one.