1

在这里,我试图创建一个截止频率为 0.1 Hz 的高通巴特沃斯数字滤波器。我已经实现了以下代码,但我不确定它是否属实

#%% creating the filter 
# filter parameters 
order=6
btype='highpass'
cutoff_frequency=0.1*2*np.pi
analog=False

b, a= signal.butter(order,cutoff_frequency,btype, analog)
w, h = signal.freqs(b, a)

plt.figure() 
plt.plot(w, 20 * np.log10(abs(h)))
plt.xscale('log')
plt.title('Butterworth filter frequency response')
plt.xlabel('Frequency [radians / second]')
plt.ylabel('Amplitude [dB]')
plt.margins(0, 0.1)
plt.grid(which='both', axis='both')
plt.axvline(0.1*2*np.pi, color='green') # cutoff frequency
plt.show()

我的困惑是关于这里的截止频率,我将它乘以 2*pi,因为据我了解 scipy.signal.butter 的 cutoff_frequency 对应于以 rad/s 为单位的角频率。

4

1 回答 1

2

Knowing that my sampling frequency is 1Hz I have performed the following steps to design the highpass 6th order Butterworth digital filter with a cutoff frequency at 0.1 Hz:

order=6 # order of the filter
btype='highpass' # type
F_sampling=1.0   # my sampling freq
Nyqvist_freq=F_sampling/2 # Nyqvist frequency in function of my sampling frequency
cut_off_Hz=0.1 # my cutoff frequency in Hz
cutoff_frequency=cut_off_Hz/Nyqvist_freq    # normalized cut_off frequency
analog=False #digital filter
b, a= signal.butter(order,cutoff_frequency,btype, analog)
w, h = signal.freqs(b, a)
Detrend_carrierPhase=signal.filtfilt(b, a, Carrier_phase) # filtering my high rate carrier phase

I am using the scipy library where the cut_off frequency is a fraction of the Nyqvist frequency and it is a non-dimensional value that's why I need to transform my sampling frequency expressed in Hz to the Nyqvist freq through dividing it by 2, so it is equal to 1Hz/2 =0.5 Hz it is the Nyqvist frequency of my system. The normalized Nyqvist cut_off freq given to the butter filter is 0.1 (Cut_off frequency in Hz) divided by 0.5 (Nyqvist frequency of my system).

I used the signal.filtfilt to filter my carrier phase (signal)

Hope this will be helpful!

于 2019-01-17T15:53:05.840 回答