调整算法?算法

2023-09-11 06:30:05 作者:贱人不贱渐渐贱

我试图找到在Matlab中的函数,或者至少是一种算法,执行以下的名称:

I am trying to find a function in Matlab, or at least the name of an algorithm that does the following:

让我们说,我分析时间序列的实时性。我最初开始为10和-10的阈值,这样,当时间序列推移高于10或低于-10,它认为是HIT'。比方说,它最初花费的时间系列5分钟产生一个重灾区,但我想调整阈值,这样,平均只需要1分钟一个'打'待产。我知道这看起来像开始用10和-10,如果时间过长,下降到5和-5,则增大阈值,如果是太快了,等。

Let's say that I am analyzing a time series in real time. I initially start with a threshold of 10 and -10, so that when the time series goes above 10 or below -10, it's considered a 'HIT'. Let's say it initially takes the time series 5 minutes to produce a 'HIT', but I want to adjust the threshold so that, on average, it takes only 1 minute for a 'HIT' to be produced. I know it would look something like start with 10 and -10, if it takes too long, drop it to 5 and -5, then increase the threshold if it's too quick, etc.

我知道有一个特定的名称,这种类型的算法,而且有可能是内置的功能这一点,但名字是躲避我。有人可以帮忙吗?

I know there's a specific name for this type of algorithm, and there's probably built-in functions for this, but the name is eluding me. Can somebody help?

推荐答案

我不知道你的时间序列的时间分辨率,或者如果它是恒定的,所以我把它留给你。不过这里是你可以在MATLAB中做什么,如果你有一个固定的时间分辨率。先取中值时间序列的绝对值。然后,使用的sort()命令按照相反的顺序这些值进行排序。然后选择其索引排序数组中给你,你的愿望的平均时间分辨率的价值。因此,如如果你的时间序列有大小N和时间分辨率为0.1秒,你要在平均警报每隔1秒,再经过分选,你会选阈值(倒序)排序位置​​N / 10。

I don't know what the time resolution of your time series is, or if it's constant, so I'll leave that to you. However here is what you can do in matlab if you have a constant time resolution. First take the absolute value of the values in your time series. Then sort these values in reverse order using the sort() command. Then choose the value whose index in the sorted array gives you the average time resolution that you desire. So e.g. if your time series has size N and the time resolution is 0.1 seconds, and you want an alert on average every 1 second, then after sorting you would choose the threshold at (reverse order) sorted position N/10.