【发布时间】:2012-06-21 07:37:40
【问题描述】:
在得到my other question 的帮助后,我正在尝试编写一种降噪算法,该算法适用于 VB.NET 数据表中的一组数据点。基本上,我想取两个整数,一个坐标值(例如yCoord)和一个阈值平滑值(NoiseThresh),然后取(yCoord - NoiseThresh, yCoord + NoiseThresh) 范围内的值的平均值并将该数字存储到大批。我会为每一列(在这个例子中)重复这个过程,最终得到一个一维的平均值数组。我的问题是:
1) 我刚才所说的一切是否有意义;),以及
2)谁能帮我写代码?我几乎没有使用数据库的经验。
谢谢!
我正在尝试做的一个例子:
//My data (pretend it's a database)
1 4 4 9 2 //yCoord would equal 5
6 3 8 12 3 //yCoord = 4
8 3 -2 2 0 //yCoord = 3
9 17 3 7 5 //yCoord = 2
4 1 0 9 7 //yCoord = 1
//In this example, my yCoord will equal 3 and NoiseThresh = 1
//For the first column
Array(column1) = //average of the set of numbers centered at yCoord = 3 _
//(in this case 8) and the NoiseThresh=1 number on either side (here 6 & 9)
//For the second column
Array(column2) = //average of the numbers 3,3,17 for example
//etc., etc.,
这将在大型数据集上执行(典型数字为 yCoord=500,NoiseThresh = 50,数组长度 = 1092),因此不可能手动输入数字。
我希望这有助于澄清我的问题!
P.S.:是的,我知道 // 不是 VB.NET 注释。
【问题讨论】:
-
这个问题的目标是内存中的
DataTable,所以你说你对数据库只有很少的经验是没有意义的,不是吗? -
不是真的...我想说的是,我希望发布的任何代码都带有解释或 cmets。
-
我想说的是,在数据库中完成这一切可能是一种更好的方法,如果这是一个具有多个用户的 Web 应用程序则更是如此。您正在将所有不可扩展的内容加载到内存中。使用 DataTable 的答案并不能帮助您理解 SQL。
-
范围部分还不清楚。
xCord/yCord/NoiseThreas指的是什么数据表?xCord是列索引,yCord是行位置,NoiseThreas是范围吗? -
xCoord/yCoord分别指的是作为降噪算法中心点的列/行。NoiseThresh是要求平均值的 xCoord 左右的数据点数,或者是要求平均值的 yCoord 上下的数据点数。我想对 xCoord 指定的列中的每个数据点以及 yCoord 指定的行中的数据点重复此平均函数。
标签: database vb.net algorithm math noise-reduction