3

I have a time series of recoreded frequencies, from which I would like to calculate secondly means. However the sample rate is not constant, which means that a simple arithmetic mean is wrong. What I would actually like to compute is the integral of the step function (described by the timeseries) within each secondly interval.

Consider for example this time series:

08:11:23.400 -> 49.9 Hz
08:11:24.200 -> 50.1 Hz
08:11:24.600 -> 50.15 Hz
08:11:24.800 -> 50.05 Hz
08:11:25.100 -> 49.95 Hz

The arithmetic mean of the second 08:11:24.000 - 08:11:25.000 would be (50.1 + 50.15 + 50.05)/3 = 50.1. But this is not the mean fequency measured in that second. It is instead: (200*49.9 + 400*50.1 + 200*50.15 + 200*50.05)/1000 = 50.06, because the measured frequencies were true for different amounts of time.

This is the calculation of a weighted mean (with the hold times as weights) or equivalently the calculation of the integral of the step function (and then deviding by the time).

First of all: Is there a name for this specific calculation? It seems a rather standard computation on time series to me. Not knowing a name for this makes it hard to google for it.

Second: Which java library supports such a calculation? I would like to avoid implementing this by myself. I refuse to believe that there is no good standard java library offering this. I was looking into the apache commons math library but without any luck (but again: maybe I'm just missing the correct term to look for).

4

2 回答 2

2

我不确定公式 200*49.9 + 400*50.1 + ... 是否正确。这意味着频率 49.9 从 08:11:23.400 到 08:11:24.200 有效,就好像频率传感器测量未来频率一样。我宁愿认为它表示过去的频率。那么,频率真的是阶跃函数吗?还是锯齿函数更接近现实?甚至是用样条线重建的平滑函数?

因此,我建议您自己计算积分,并准备好更改计算公式。至于错误,您同样可以在从库中选择函数以及设置其参数时出错。

于 2013-01-04T13:09:56.053 回答
0

Java中没有多少库可以正确地做到这一点。但是您要寻找的基本内容是数字信号处理。

这是一个类似的问题:Java 中的信号处理库?

于 2013-01-05T01:05:32.540 回答