java中是否有一个函数可以获得移动平均值 [英] Is there a function in java to get moving average

查看:994
本文介绍了java中是否有一个函数可以获得移动平均值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到需要每0.5秒从设备处理5000个样本的情况。

I have a situation where I need to process 5000 samples from a device in every 0.5 sec.

假设窗口大小为100,那么移动平均线将产生50个点。我正在尝试使用传统方法,即使用循环。但这是一种非常低效的方法。有什么建议吗?

Lets say the window size is 100, then there would be 50 points resulting from the moving average. I am trying with conventional method, i.e. with loops. But this is a very inefficient way to do it. Any suggestions ?

推荐答案

查看 Apache Maths 库。这有方法可以准确地做你想要的。参见 DescriptiveStatistics 平均值以获取更多信息。

Check out the Apache Maths library. This has methods for doing precisely what you want. See DescriptiveStatistics and Mean for more info.

这篇关于java中是否有一个函数可以获得移动平均值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆