switch(m_SmoothMode)
{
case 0: //三点线性
for(i=2+offsetpos;i<datanum-2;i++)
{
m_pfDataArray[i] = (m_pfDataArray[i-1]+m_pfDataArray[i]+m_pfDataArray[i+1])/3;
}
break;
case 1://五点二次滤波
for(i=2+offsetpos;i<datanum-2;i++)
{
m_pfDataArray[i] = (12*(m_pfDataArray[i-1]+m_pfDataArray[i+1])
-3*(m_pfDataArray[i-2]+m_pfDataArray[i+2])
+17*m_pfDataArray[i])/35;
}
break;
case 2://三点钟形滤波
for(i=2+offsetpos;i<datanum-2;i++)
{
m_pfDataArray[i] = (short)(0.212f*m_pfDataArray[i-1]+0.576f*m_pfDataArray[i]
+0.212f*m_pfDataArray[i+1]);
}
break;
case 3://五点钟形滤波
for(i=2+offsetpos;i<datanum-2;i++)
{
m_pfDataArray[i] = (short)(0.11f*(m_pfDataArray[i-2]+m_pfDataArray[i+2])
+0.24f*(m_pfDataArray[i-1]+m_pfDataArray[i+1])
+0.3f*m_pfDataArray[i]);
}
break;
case 4://三点汉明滤波
for(i=2+offsetpos;i<datanum-2;i++)
{
m_pfDataArray[i] = (short)(0.07f*m_pfDataArray[i-1]+0.86f*m_pfDataArray[i]
+0.07f*m_pfDataArray[i+1]);
}
break;
default://五点汉明滤波
for(i=2+offsetpos;i<datanum-2;i++)
{
m_pfDataArray[i] = (short)(0.04f*(m_pfDataArray[i-2]+m_pfDataArray[i+2])
+0.24f*(m_pfDataArray[i-1]+m_pfDataArray[i+1])
+0.44f*m_pfDataArray[i]);
}
break;
}
道格拉斯-普克抽稀算法