自动推断时间序列图的比例

发布于 2024-08-22 20:52:24 字数 336 浏览 2 评论 0原文

问题:

我正在绘制一个时间序列。我不知道先验的最小值和最小值最大值。我想绘制最后 5 秒的数据。我希望绘图能够自动重新调整自身比例,以最适合过去五秒的数据。然而,我不希望重新缩放变得不稳定(因为人们会通过不断重置最小值和最大值来实现)——当它重新缩放时,我希望重新缩放是平滑的。

是否有任何现有的算法可以处理这个问题?

形式上:

我有一个函数

float Sample();

您可以多次调用。我希望您能够不断地、实时地向我绘制最后 5 * 60 个值,并且图表的比例很好。我希望图表自动重新缩放;但不是以“生涩”的方式。

谢谢!

Problem:

I am plotting a time series. I don't know apriori the minimum & maximum values. I want to plot it for the last 5 seconds of data. I want the plot to automaticaly rescale itself to best fit the data for the past five seconds. However, I don't want the rescaling to be jerky (as one would get by constantly resetting the min & max) -- when it does rescale, I want the rescaling to be smooth.

Are there any existing algorithms for handling this?

Formally:

I have a function

float sample();

that you can call multiple times. I want you to constantly, in real time, plot the last 5 * 60 values to me, with the chart nicely scaled. I want the chart to automatically rescale; but not in a "jerky" way.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世态炎凉 2024-08-29 20:52:24

您可以尝试类似的方法并降低调整速度。

 float currentScale = 0;
 float adjustSpeed = .3f;

 void iterate() {

       float targetScale = sample();
       currentScale += adjustSpeed * (targetScale - currentScale);

 }

如果太不稳定,

You could try something like

 float currentScale = 0;
 float adjustSpeed = .3f;

 void iterate() {

       float targetScale = sample();
       currentScale += adjustSpeed * (targetScale - currentScale);

 }

And lower the adjustSpeed if it's too jerky.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文