Bandpass Filter Output & Fourier Transform

712 views Asked by At

I'm trying ko eliminate noise and some other frequencies that I do not require from this waveform: trimmed signal

As you can see in the picture below, it has a lot of noise in it: noise

I apply the fast fourier transform using numpy to convert this into frequency domain: (channelA and time are numpy arrays, channelA storing voltage values)

fY = np.fft.fft(channelA)
freq = np.fft.fftfreq(len(channelA), time[1]-time[0])

Here is the transform: fft When zoomed in: fft zoomed I apply a butterworth bandpass filter using scipy in python. Here is the code:

low = 100 / (0.5 * 2e6)   # nyq = 1/2 * fs
high = 1e3 / (0.5 * 2e6)
sos = sp.butter(1, [low, high], btype='bandpass', output='sos')
y = sp.sosfiltfilt(sos, channelA)

Here my sampling rate is 2M (2e6), and my passband frequencies are 100-1kHz. After applying the filter, the signal seems to have lost the noise but however the voltage at the start goes negative. I do not understand why. Can someone explain why this is happening? filtered signal Zoomed in to show no noise left: no noise

Voltage goes negative when I apply the highpass filter. If I only apply the lowpass filter, the noise gets eliminated. (highpass and lowpass filters can be applied using the same function)

This is the transform of the filtered signal: filtered fft Zoomed in: filtered fft zoomed

As can be seen, frequencies less than 100Hz are still present and frequencies around 350Hz have been removed. I'm trying to get a focus on frequencies around 350-400Hz and want to eliminate the rest of the frequencies while not distorting the signal. Why is this happening and what should I do to achieve this?

P.S. I'm sorry the post is kind of long but I don't have another way of explaining this.

0

There are 0 answers