指定重量的Boxcar平均算法 [英] boxcar averaging algorithm of the specified weight
问题描述
好吧,我需要编写一个Java算法,模拟 SMOOTH函数在 IDL 中.但是我不太确定该算法如何工作.光滑方程由下式给出:
Ok, I need to write a java algorithm which simulates the SMOOTH function written in IDL. But I'm not quite sure how that algorithm works. The smooth equation is given by:
我知道关于Boxcar平均,已经有一个类似的帖子.但是算法似乎有所不同.
I know there is already a similar post regarding boxcar averaging. But the algorithm seems to be different.
我在此等式中理解的是,有两个状态(如果声明),第一个状态是计算权重平均值,第二个状态是忽略边界.
What I understand in this equation is that there is two states (if statement), the first one is calculating the weight average, the second one is to ignore the boundary.
在第一个等式中,我想我得到了总和表示法,它从0到(w-1)开始.
In the first equation, I think I got the summation notation, it starts from 0 to (w - 1).
我没有得到的是内部求和Ai+j-w/2
.
What I don't get is the one inside summation Ai+j-w/2
.
以下是使用IDL计算的样本数据(大数据的角落部分).我用权重5来计算.
The following is the sample data (just corner part of large data) that was calculated using IDL. I used weight 5 to calculate this.
请给我解释一下该算法的工作原理.
Please, explain me how that algorithm works.
谢谢
推荐答案
您希望i
的平均值来自第i
点附近的窗口.因此,它必须在该点之前开始,并在此之后结束.
You want the i
'th average to be from a window around the i
'th point. So it has to start before that point, and end after.
减去索引中的w/2
会导致j=0
是您想要的窗口的开始,而j=w-1
是您想要的窗口的结束.
Subtracting off w/2
in the index causes j=0
to be the start of the window you want, and j=w-1
to be the end of the window you want.
取而代之的是从j=-w/2
到j=w/2-1
的总和.
It would be entirely equivalent to sum from j=-w/2
to j=w/2-1
instead.
这篇关于指定重量的Boxcar平均算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!