No account yet ?
Tested in Anaconda and Python 3.7
from scipy import signal import matplotlib.pyplot as plt import numpy as np b, a = signal.butter(4, 100, 'low', analog=True) w, h = signal.freqs(b, a) plt.semilogx(w, 20 * np.log10(np.abs(h)), color='silver', ls='dashed') b, a = signal.bessel(4, 100, 'low', analog=True, norm='phase') w, h = signal.freqs(b, a) plt.semilogx(w, 20 * np.log10(np.abs(h))) plt.title('Bessel filter magnitude response (with Butterworth)') plt.xlabel('Frequency [radians / second]') plt.ylabel('Amplitude [dB]') plt.margins(0, 0.1) plt.grid(which='both', axis='both') plt.axvline(100, color='green') # cutoff frequency plt.show() plt.figure() plt.semilogx(w, np.unwrap(np.angle(h))) plt.axvline(100, color='green') # cutoff frequency plt.axhline(-np.pi, color='red') # phase midpoint plt.title('Bessel filter phase response') plt.xlabel('Frequency [radians / second]') plt.ylabel('Phase [radians]') plt.margins(0, 0.1) plt.grid(which='both', axis='both') plt.show() b, a = signal.bessel(3, 10, 'low', analog=True, norm='mag') w, h = signal.freqs(b, a) plt.semilogx(w, 20 * np.log10(np.abs(h))) plt.axhline(-3, color='red') # -3 dB magnitude plt.axvline(10, color='green') # cutoff frequency plt.title('Magnitude-normalized Bessel filter frequency response') plt.xlabel('Frequency [radians / second]') plt.ylabel('Amplitude [dB]') plt.margins(0, 0.1) plt.grid(which='both', axis='both') plt.show() b, a = signal.bessel(5, 1/0.1, 'low', analog=True, norm='delay') w, h = signal.freqs(b, a) plt.figure() plt.semilogx(w[1:], -np.diff(np.unwrap(np.angle(h)))/np.diff(w)) plt.axhline(0.1, color='red') # 0.1 seconds group delay plt.title('Bessel filter group delay') plt.xlabel('Frequency [radians / second]') plt.ylabel('Group delay [seconds]') plt.margins(0, 0.1) plt.grid(which='both', axis='both') plt.show()
Bessel functions
Tested in Anaconda and Python 3.7
import numpy as np ; import pylab as pl from scipy.special import jn x = np.linspace(-5, 15, 100) for i in range(10): y = jn(i, x) pl.plot(x, y, label='$j_%i$' % i) pl.title('Fonctions de Bessel') pl.legend()
Welcome, my name is Eric Soupet and I am the administrator of the site elodees.com. elodees.com is a state of the art of Artificial Intelligence and aims to be collaborative, you can now offer content such as articles, events, tutorials, ... so don't hesitate !
Platform images credit : Pixabay - Pixabay License | Pexels - Pexels License