最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python 經(jīng)典數(shù)字濾波實例

 更新時間:2019年12月16日 16:47:40   作者:weixin_42528089  
今天小編就為大家分享一篇python 經(jīng)典數(shù)字濾波實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

數(shù)字濾波分為 IIR 濾波,和FIR 濾波。

FIR 濾波:

import scipy.signal as signal
import numpy as np
import pylab as pl
import matplotlib.pyplot as plt
import matplotlib
from scipy import signal
b = signal.firwin(80, 0.5, window=('kaiser', 8))
w, h = signal.freqz(b)
 
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots()
ax1.set_title('Digital filter frequency response')
 
ax1.plot(w, 20 * np.log10(abs(h)), 'b')
ax1.set_ylabel('Amplitude [dB]', color='b')
ax1.set_xlabel('Frequency [rad/sample]')
 
ax2 = ax1.twinx()
angles = np.unwrap(np.angle(h))
ax2.plot(w, angles, 'g')
ax2.set_ylabel('Angle (radians)', color='g')
ax2.grid()
ax2.axis('tight')
plt.show()

運行結(jié)果:

IIR 濾波器:

from scipy import signal
import matplotlib.pyplot as plt
import matplotlib.ticker
import numpy as np
# 藍色的是頻譜圖,綠色的是相位圖
wp = 0.2
ws = 0.3
gpass = 1
gstop = 40
system = signal.iirdesign(wp, ws, gpass, gstop)
w, h = signal.freqz(*system)
fig, ax1 = plt.subplots()
ax1.set_title('Digital filter frequency response')
ax1.plot(w, 20 * np.log10(abs(h)), 'b')
ax1.set_ylabel('Amplitude [dB]', color='b')
ax1.set_xlabel('Frequency [rad/sample]')
ax1.grid()
ax1.set_ylim([-110, 10])
 
nticks = 8
ax1.yaxis.set_major_locator(matplotlib.ticker.LinearLocator(nticks))
 
plt.show()

運行結(jié)果:

IIR 濾波器中cheyb2 濾波器的運用

from  scipy import signal
import matplotlib.pyplot as plt
import numpy as np
b, a = signal.cheby2(4, 40, 100, 'low', analog=True)
w, h = signal.freqs(b, a)
plt.semilogx(w, 20 * np.log10(abs(h)))#用于繪制折線圖,兩個函數(shù)的 x 軸、y 軸分別是指數(shù)型的。
#plt.plot(w, 20 * np.log10(abs(h)))
plt.title('Chebyshev Type II frequency response (rs=40)')
plt.xlabel('Frequency [radians / second]')
plt.ylabel('Amplitude [dB]')
plt.margins(0, 0.1)#  not sure
plt.grid(which='both', axis='both')
 
t = np.linspace(0, 1, 1000, False) # 1 second
sig = np.sin(2*np.pi*10*t) + np.sin(2*np.pi*20*t)
fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
ax1.plot(t, sig)
ax1.set_title('10 Hz and 20 Hz sinusoids')
ax1.axis([0, 1, -2, 2])
 
sos = signal.cheby2(12, 20, 17, 'hp', fs=1000, output='sos')
filtered = signal.sosfilt(sos, sig)
ax2.plot(t, filtered)
ax2.set_title('After 17 Hz high-pass filter')
ax2.axis([0, 1, -2, 2])
ax2.set_xlabel('Time [seconds]')
 
plt.show()

以上這篇python 經(jīng)典數(shù)字濾波實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • 利用Python如何生成便簽圖片詳解

    利用Python如何生成便簽圖片詳解

    python現(xiàn)在火熱的程度相信不用過多介紹了,下面這篇文章主要給大家介紹了關(guān)于利用Python如何生成便簽圖片的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家學(xué)習(xí)或者使用python具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-07-07
  • python實現(xiàn)函數(shù)極小值

    python實現(xiàn)函數(shù)極小值

    今天小編就為大家分享一篇python實現(xiàn)函數(shù)極小值,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-07-07
  • Python轉(zhuǎn)換itertools.chain對象為數(shù)組的方法

    Python轉(zhuǎn)換itertools.chain對象為數(shù)組的方法

    這篇文章主要介紹了Python轉(zhuǎn)換itertools.chain對象為數(shù)組的方法,通過代碼給大家介紹了itertools 的 chain() 方法,需要的朋友可以參考下
    2020-02-02
  • opencv函數(shù)threshold、adaptiveThreshold、Otsu二值化的實現(xiàn)

    opencv函數(shù)threshold、adaptiveThreshold、Otsu二值化的實現(xiàn)

    這篇文章主要介紹了opencv函數(shù)threshold、adaptiveThreshold、Otsu二值化的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • OpenCV-Python 實現(xiàn)兩張圖片自動拼接成全景圖

    OpenCV-Python 實現(xiàn)兩張圖片自動拼接成全景圖

    圖片的全景拼接如今已不再稀奇,現(xiàn)在的智能攝像機和手機攝像頭基本都帶有圖片自動全景拼接的功能,本文使用OpenCV-Python 實現(xiàn)兩張圖片自動拼接成全景圖,感興趣的可以了解一下
    2021-06-06
  • Python2 Selenium元素定位的實現(xiàn)(8種)

    Python2 Selenium元素定位的實現(xiàn)(8種)

    這篇文章主要介紹了Python2 Selenium元素定位的實現(xiàn),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-02-02
  • Python?Diagrams創(chuàng)建高質(zhì)量圖表和流程圖實例探究

    Python?Diagrams創(chuàng)建高質(zhì)量圖表和流程圖實例探究

    Python?Diagrams是一個強大的Python庫,使創(chuàng)建這些圖表變得簡單且靈活,本文將深入介紹Python?Diagrams,包括其基本概念、安裝方法、示例代碼以及一些高級用法,以幫助大家充分利用這一工具來創(chuàng)建令人印象深刻的圖表
    2024-01-01
  • python基礎(chǔ)之元組

    python基礎(chǔ)之元組

    這篇文章主要介紹了python的元組,實例分析了Python中返回一個返回值與多個返回值的方法,需要的朋友可以參考下
    2021-10-10
  • 分享Python字符串關(guān)鍵點

    分享Python字符串關(guān)鍵點

    字符串是 Python 中最常用的數(shù)據(jù)類型。我們可以使用引號來創(chuàng)建字符串,通過本篇文章給大家分享python字符串關(guān)鍵點相關(guān)資料,感興趣的朋友一起學(xué)習(xí)吧
    2015-12-12
  • Python中random模塊生成隨機數(shù)詳解

    Python中random模塊生成隨機數(shù)詳解

    本文給大家匯總了一下在Python中random模塊中最常用的生成隨機數(shù)的方法,有需要的小伙伴可以參考下
    2016-03-03

最新評論

姚安县| 通江县| 奉节县| 西宁市| 昌平区| 延安市| 峨眉山市| 腾冲县| 湖南省| 新郑市| 宁都县| 绥滨县| 固原市| 盐边县| 新晃| 秦安县| 永登县| 石阡县| 常熟市| 哈巴河县| 长顺县| 淮北市| 平罗县| 鹿邑县| 台东市| 旌德县| 仁怀市| 泽州县| 湘阴县| 伽师县| 福建省| 恩平市| 和田县| 敖汉旗| 卫辉市| 班戈县| 广宗县| 当涂县| 高要市| 天柱县| 贡嘎县|