带通滤波器的绘制(Python)

摘要:x = np.array([0, 1, 2, 2.0001, 3, 3.9999, 4, 5, 6]) y = np.array([0, 0, 0, 1, 1, 1, 0, 0, 0])plt.plot(x, y, 'k', linewidth=3)plt.y

import numpy as np from matplotlib import pyplot as plt

Ideal BPF

x = np.array([0, 1, 2, 2.0001, 3, 3.9999, 4, 5, 6]) y = np.array([0, 0, 0, 1, 1, 1, 0, 0, 0])plt.plot(x, y, 'k', linewidth=3)plt.ylabel('Response') plt.xlabel('Frequency')

Second-Order Band-Pass Filter

x = np.arange(0, 20, 0.1)wo = 10 Qp = 5y = ((wo/Qp)*x)/np.sqrt((wo**2 - x**2)**2 + (wo*x/Qp)**2)plt.plot(x, y, linewidth = 3)plt.plot(x, (1/np.sqrt(2)*np.ones(len(x))), '--', color='black')plt.plot(wo*np.ones(2), [0, 1], 'r--')plt.plot(wo*(np.sqrt(1 + (1/(4*Qp**2))) + 1/(2*Qp))*np.ones(2), [0, 1], '--', color='orange')plt.plot(wo*(np.sqrt(1 + (1/(4*Qp**2))) - 1/(2*Qp))*np.ones(2), [0, 1], '--', color='orange')plt.xlim(left=0, right=20)plt.ylim(bottom = 0, top = 1)plt.xlabel('Frequency')plt.ylabel('Response')plt.legend(['Response', 'Characterstic Freq', 'Critical Freq', '1/root(2)'])

Capacitive Passive BPF

x = np.arange(0, 70, 0.1)R1 = 10000C1 = 0.00001R2 = 40000C2 = 0.00001G = (R1*C1/(R1*C1 + R2*C2 + R1*C2))wo = np.sqrt(1/(R1*C1*R2*C2))dw = 1/(R1*C1) + 1/(R2*C2) + 1/(R1*C2)bw = np.sqrt(abs(2*G**2-1))*dw w1 = (1/2)*(np.sqrt(4*wo**2 + bw**2) - bw)w2 = (1/2)*(np.sqrt(4*wo**2 + bw**2) + bw)y = (x/(R2*C2))/np.sqrt((1/(R1*R2*C1*C2) - x**2)**2 + ((R1*C1 + R2*C2 + R1*C2)/(R1*R2*C1*C2)*x)**2)plt.plot(x, y, linewidth = 3)plt.plot(wo*np.ones(2), [0, 0.5], 'r--')plt.plot(x, G*(np.ones(len(x))), '--', color='black')plt.plot(w1*np.ones(2), [0, 0.5], '--', color = 'orange')plt.plot(w2*np.ones(2), [0, 0.5], '--', color = 'orange')plt.xlim(left=0, right=50)plt.ylim(bottom = 0, top = 0.5)plt.legend(['Response', 'Characterstic Freq', 'Gain', 'Critical Freq'])plt.xlabel('Frequency')plt.ylabel('Response')

Active Capacitive LPF

x = np.arange(0, 70, 0.1)R1 = 10000C1 = 0.00001R2 = 40000C2 = 0.00001G = (R2*C1/(R1*C1 + R2*C2))wo = np.sqrt(1/(R1*C1*R2*C2))dw = 1/(R1*C1) + 1/(R2*C2)bw = np.sqrt(abs(2*G**2-1))*dw w1 = (1/2)*(np.sqrt(4*wo**2 + bw**2) - bw)w2 = (1/2)*(np.sqrt(4*wo**2 + bw**2) + bw)y = (x/(R1*C2))/np.sqrt((1/(R1*R2*C1*C2) - x**2)**2 + ((R1*C1 + R2*C2)/(R1*R2*C1*C2)*x)**2)plt.plot(x, y, linewidth = 3)plt.plot(wo*np.ones(2), [0, 1], 'r--')plt.plot(x, G*(np.ones(len(x))), '--', color='black')plt.plot(w1*np.ones(2), [0, 1], '--', color = 'orange')plt.plot(w2*np.ones(2), [0, 1], '--', color = 'orange')plt.xlim(left=0, right=50)plt.ylim(bottom = 0, top = 1)plt.legend(['Response', 'Characterstic Freq', 'Gain', 'Critical Freq'])plt.xlabel('Frequency')plt.ylabel('Response')

知乎学术咨询:

https://www.zhihu.com/consult/people/792359672131756032?isMe=1

担任《Mechanical System and Signal Processing》《中国电机工程学报》等期刊审稿专家,擅长领域:信号滤波/降噪,机器学习/深度学习,时间序列预分析/预测,设备故障诊断/缺陷检测/异常检测。

分割线分割线分割线

基于小波分析的时间序列降噪(Python,ipynb文件)

完整代码:

时间序列的最大重叠离散小波分解(Python)

完整代码:

基于连续小波变换的信号滤波方法(Python,ipynb文件)

信号的时域、频域和时频域特征提取(Python)

完整代码:

不同小波族的优缺点

来源:起跑123

相关推荐