日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python 希尔伯特变换_python scipy signal.hilbert用法及代码示例

發布時間:2023/12/19 python 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 希尔伯特变换_python scipy signal.hilbert用法及代码示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

使用希爾伯特變換來計算分析信號。

默認情況下,轉換是沿著最后一個軸完成的。

參數:

x:array_like信號數據。必須是真實的。

N:int, 可選參數傅立葉分量的數量。默認:x.shape[axis]

axis:int, 可選參數沿其進行轉換的軸。默認值:-1

返回值:

xa:ndarray沿軸的每個1-D數組x的解析信號

注意:

分析信號x_a(t)信號的x(t)是:

其中F是傅立葉變換,U是單位階躍函數,y是x的希爾伯特變換。[1]

換句話說,頻譜的負一半被清零,從而將實值信號轉換為復數信號。希爾伯特變換信號可以從np.imag(hilbert(x)),以及來自的原始信號np.real(hilbert(x))。

參考文獻:

2

Leon Cohen,“ Time-Frequency分析”,1995年。第2章。

3

艾倫·奧本海姆(Alan V. Discrete-Time Signal Processing,第三版,2009年。第12章。ISBN13:978-1292-02572-8

例子:

在此示例中,我們使用希爾伯特變換來確定amplitude-modulated信號的幅度包絡和瞬時頻率。

>>> import numpy as np

>>> import matplotlib.pyplot as plt

>>> from scipy.signal import hilbert, chirp

>>> duration = 1.0

>>> fs = 400.0

>>> samples = int(fs*duration)

>>> t = np.arange(samples) / fs

我們創建一個rp,其頻率從20 Hz增加到100 Hz,并應用幅度調制。

>>> signal = chirp(t, 20.0, t[-1], 100.0)

>>> signal *= (1.0 + 0.5 * np.sin(2.0*np.pi*3.0*t) )

幅度包絡由分析信號的幅度給出。瞬時頻率可以通過相對于時間區分瞬時相位來獲得。瞬時相位對應于分析信號的相位角。

>>> analytic_signal = hilbert(signal)

>>> amplitude_envelope = np.abs(analytic_signal)

>>> instantaneous_phase = np.unwrap(np.angle(analytic_signal))

>>> instantaneous_frequency = (np.diff(instantaneous_phase) /

... (2.0*np.pi) * fs)

>>> fig = plt.figure()

>>> ax0 = fig.add_subplot(211)

>>> ax0.plot(t, signal, label='signal')

>>> ax0.plot(t, amplitude_envelope, label='envelope')

>>> ax0.set_xlabel("time in seconds")

>>> ax0.legend()

>>> ax1 = fig.add_subplot(212)

>>> ax1.plot(t[1:], instantaneous_frequency)

>>> ax1.set_xlabel("time in seconds")

>>> ax1.set_ylim(0.0, 120.0)

總結

以上是生活随笔為你收集整理的python 希尔伯特变换_python scipy signal.hilbert用法及代码示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。