admin管理员组文章数量:1289753
I'm learning on signal process and I'm trying to simulate a First-order low-pass filter as the equation below:
(1+ω)y[n]=x[n]+ωy[n-1]
where y[n] denotes the output and x[n] denotes input.
So I try to use this filter with filtfilt
to process a series of samples, the ω is 5:
import scipy.signal as signal
import matplotlib.pyplot as plt
b = [1]
a = [6, -5]
#loading origin-CH1 0.txt
x = []
with open("origin'-CH1 20.txt", 'r') as f:
for line in f:
x.append(float(line))
y = signal.filtfilt(b=b, a=a, x=x,method='gust')
#writing output to origin-CH1 0.txt
with open("origin'--CH1 0.txt", 'w') as f:
for i in y:
f.write(str(i) + '\n')
#plot
plt.plot(y, label="After Filter", color='red')
plt.plot(x, label="Before Filter", color='blue',alpha=0.5)
plt.show()
but the samples filtered seems innormal
You can see that there is a significant upward trend in the starting position of the filtered data, which is weird. I try to lower the value of ω, but it seems not quite useful. Why would this happen? If u need here is the origin samples origin'-CH1 20.txt
本文标签:
版权声明:本文标题:python - using SciPy.signal.filtfilt but an exception occurred at the beginning or boundary position - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741445920a2379199.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论