平滑 wifi 信号强度的算法
当测量两个静态点之间的 Wifi 信号强度时,测量结果会因环境因素而不断波动。
什么是平滑小波动并检测显着变化的好算法?指数移动平均线?
When measuring the strength of a Wifi signal between two static points, the measurement constantly fluctuates due to environmental factors.
What is a good algorithm to use smooth out small fluctuations and detect significant changes? Exponential moving average?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
某种低通滤波通常适用于这样的情况:
根据所需的平滑量选择 alpha。 x 包含原始输入样本,y 包含过滤结果。
Some sort of low pass filtering usually works for things like this:
where alpha is chosen based on the amount of smoothing desired. x contains the raw input samples and y contains the filtered result.
指数移动平均线是估计信号当前真实值的好方法,正如您在上面所看到的,它以多种伪装和多种不同的理由出现。
检测显着变化的问题略有不同,并且已作为统计质量控制的一部分进行研究。一个简单的工具是 http://en.wikipedia.org/wiki/CUSUM。维基百科页面告诉您足够的信息来实现这一点,但没有告诉您如何在 S[n+1] = S[n] + Min(0, S[n] + X[n] - W) 中设置 W,或者什么值S[n]表示它检测到了某些东西。您可以比我进行更深入的搜索,查看诸如蒙哥马利的“统计质量控制简介”之类的文本,或者只是获取大量数据并看看哪些在现实生活中有效。
我首先将 W 设置为一切正常时长期信号强度典型值的平均值,以及应该让您实际执行某些操作的长期信号强度的第一个值,然后在历史数据上绘制此结果看看它是否看起来理智,如果是的话,S[n] 的值应该让你真正做某事。 (X[n] 当然是原始测量信号强度)。
Exponential moving average is a good way of estimating the current true value of the signal, which as you can see above has popped up under a number of disguises with a number of different justifications.
The problem of detecting significant changes is slightly different, and has been studied as part of statistical quality control. One simple tool for this is http://en.wikipedia.org/wiki/CUSUM. The wikipedia page tells you enough to implement this, but not how to set W in S[n+1] = S[n] + Min(0, S[n] + X[n] - W), or what value of S[n] means that it has detected something. You could search further than I have, look in texts such as "Introduction to Statistical Quality Control" by Montgomery, or just grab lots of data and see what works in real life.
I would start by setting W to be the average of the typical value of long term signal strength when everything is OK and the first value of long term signal strength that should make you actually do something, and then plot the results of this on historical data to see if it looks sane and, if so, what value of S[n] should make you actually do something. (X[n] is of course the raw measured signal strength).