我使用 Math.Net.Numerics 首先用正弦波填充数组,然后使用 Math.Net.Filtering 创建带通来过滤数据,如下所示:
void Main()
{
double[] preProcessedData = new double[128];
double[] postProcessedData = new double[128];
//Generate sinewave (350Hz, 250 samples)
preProcessedData = MathNet.Numerics.Generate.Sinusoidal(250, 44100, 350, 20);
postProcessedData = preProcessedData;
MathNet.Filtering.OnlineFilter bandPass = MathNet.Filtering.OnlineFilter.CreateBandpass(MathNet.Filtering.ImpulseResponse.Finite, 44100, 390, 410);
bandPass.ProcessSamples(postProcessedData);
//LINQPad extensions
preProcessedData.Dump();
postProcessedData.Dump();
}
但是,这似乎根本没有过滤样本,如这里所示(相同):
Unfiltered Filtered
1.139189962 1.139189962
2.274680952 2.274680952
3.402786006 3.402786006
4.519842146 4.519842146
5.622222267 5.622222267
6.706346918 6.706346918
7.768695925 7.768695925
8.80581982 8.80581982
9.81435104 9.81435104
10.79101486 10.79101486
11.73264004 11.73264004
12.6361691 12.6361691
13.49866827 13.49866827
14.31733699 14.31733699
15.08951702 15.08951702
15.81270108 15.81270108
16.48454099 16.48454099
17.10285526 17.10285526
我究竟做错了什么?该库可用的文档似乎还不是很完整,所以我从那里学到的东西不多。