def plot_bode(self,b,c): s1 = signal.lti(b,c) w, mag, phase = signal.bode(s1) plt.figure() plt.grid() plt.semilog(w, mag) plt.semilog(w, phase) plt.show()
def plot_bode(self, b, c): s1 = signal.lti(b, c) w, mag, phase = signal.bode(s1) plt.figure() plt.grid() plt.semilog(w, mag) plt.semilog(w, phase) plt.show()
def basic_plot(params): # nothing fancy, just plot it if params.type == "loglog": plt.loglog(params.xax, params.yax, '.') elif params.type == "log": plt.semilog(params.xax, params.yax, '.') elif params.type == "bar": plt.bar(params.xax, params.yax) else: plt.plot(params.xax, params.yax, '.') plt.xlabel(params.xlabel) plt.ylabel(params.ylabel) plt.title(params.title) plt.show()
from scipy import signal import matplotlib.pyplot as plt import numpy as np fs = 10e3 N = 1e5 amp = 2 * np.sqrt(2) freq = 1234.0 noise_power = 0.001 * fs / 2 time = np.arange(N) / fs x = amp * np.sin(2 * np.pi * freq * time) x += np.random.normal(scale=np.sqrt(noise_power), size=time.shape) f, Pxx_den = signal.welch(x, fs, nperseg=1024) plt.semilog(f, Pxx_den) plt.ylim(0.5e-3, 1) plt.xlabel('frequency (Hz)') plt.ylabel('PSD [V**2/Hz]') plt.show()
from scipy import signal import matplotlib.pyplot as plt import numpy as np fs = 10e3 N=1e5 amp = 2*np.sqrt(2) freq = 1234.0 noise_power =0.001 * fs / 2 time = np.arange(N) / fs x = amp*np.sin(2*np.pi*freq*time) x += np.random.normal(scale=np.sqrt(noise_power), size=time.shape) f, Pxx_den = signal.welch(x, fs, nperseg=1024) plt.semilog(f, Pxx_den) plt.ylim(0.5e-3, 1) plt.xlabel('frequency (Hz)') plt.ylabel('PSD [V**2/Hz]') plt.show()