Function RemoveSpikes(waveName, threshold)
Wave waveName
Variable threshold
// Get the size of the input wave
Variable waveSize
waveSize = numpnts(waveName)
// Loop through each point in the original wave
Variable i, val
for (i=1; i<waveSize-1; i+=1)
val = waveName[i]
// Calculate the difference between adjacent values
Variable diffPrev = abs(waveName[i] - waveName[i-1])
Variable diffNext = abs(waveName[i+1] - waveName[i])
// Check if the difference exceeds the threshold
if (diffPrev > threshold || diffNext > threshold)
// Assign NaN to the spike
waveName[i] = NaN
endif
endfor
End
// Example usage:
// Replace "YourWave" with the name of your wave and adjust the threshold value as needed
RemoveSpikes YourWave, 10
Igor Pro 去除数据毛刺
最新推荐文章于 2024-04-20 01:44:22 发布