关于希尔伯特变换小记
讲解希尔伯特变换(Hilbert Transform)
1. 希尔伯特变换的定义
希尔伯特变换(Hilbert Transform, HT)是一种信号处理技术,它通过 移相 操作将实信号转换为 解析信号,从而用于分析信号的 瞬时幅值、瞬时相位和瞬时频率。
对于一个 实信号 x ( t ) x(t) x(t),它的希尔伯特变换 H { x ( t ) } \mathcal{H}\{x(t)\} H{x(t)} 定义为:
x ^ ( t ) = H { x ( t ) } = 1 π P.V. ∫ − ∞ + ∞ x ( τ ) t − τ d τ \hat{x}(t) = \mathcal{H}\{x(t)\} = \frac{1}{\pi} \text{P.V.} \int_{-\infty}^{+\infty} \frac{x(\tau)}{t - \tau} d\tau x^(t)=H{x(t)}=π1P.V.∫−∞+∞t−τx(τ)dτ
其中:
- P.V.(Cauchy 主值积分)用于避免奇点 t = τ t = \tau t=τ 处的发散问题。
- 希尔伯特变换的作用:它对 信号的所有正频率分量引入 − 9 0 ∘ -90^\circ −90∘ 的相移,对负频率分量引入 + 9 0 ∘ +90^\circ +90∘ 的相移,而信号的幅值保持不变。
2. 解析信号与瞬时属性
2.1 解析信号(Analytic Signal)
解析信号 z ( t ) z(t) z(t) 是由原始信号 x ( t ) x(t) x(t) 和其希尔伯特变换 x ^ ( t ) \hat{x}(t) x^(t) 构成的复信号:
z ( t ) = x ( t ) + j x ^ ( t ) z(t) = x(t) + j\hat{x}(t) z(t)=x(t)+jx^(t)
解析信号的极坐标形式:
z ( t ) = A ( t ) e j ϕ ( t ) z(t) = A(t)e^{j\phi(t)} z(t)=A(t)ejϕ(t)
其中:
-
瞬时幅值(Envelope, 包络): A ( t ) A(t) A(t)
A ( t ) = ∣ z ( t ) ∣ = x 2 ( t ) + x ^ 2 ( t ) A(t) = |z(t)| = \sqrt{x^2(t) + \hat{x}^2(t)} A(t)=∣z(t)∣=x2(t)+x^2(t)
代表信号在不同时间点的 瞬时能量分布。 -
瞬时相位(Instantaneous Phase): ϕ ( t ) \phi(t) ϕ(t)
ϕ ( t ) = arg ( z ( t ) ) = tan − 1 ( x ^ ( t ) x ( t ) ) \phi(t) = \arg(z(t)) = \tan^{-1} \left( \frac{\hat{x}(t)}{x(t)} \right) ϕ(t)=arg(z(t))=tan−1(x(t)x^(t))
代表信号在不同时间点的 瞬时相位。 -
瞬时频率(Instantaneous Frequency): ω ( t ) \omega(t) ω(t)
ω ( t ) = d ϕ ( t ) d t \omega(t) = \frac{d\phi(t)}{dt} ω(t)=dtdϕ(t)
代表信号的 瞬时频率变化。
3. 希尔伯特变换的频域特性
希尔伯特变换的核心是 对频谱的相移。
设信号 x ( t ) x(t) x(t) 的傅立叶变换为:
X ( f ) = F { x ( t ) } X(f) = \mathcal{F}\{x(t)\} X(f)=F{x(t)}
则其希尔伯特变换的傅立叶变换为:
F { x ^ ( t ) } = − j ⋅ sgn ( f ) X ( f ) \mathcal{F} \{\hat{x}(t)\} = -j \cdot \text{sgn}(f) X(f) F{x^(t)}=−j⋅sgn(f)X(f)
其中:
sgn ( f ) = { + 1 , f > 0 0 , f = 0 − 1 , f < 0 \text{sgn}(f) = \begin{cases} +1, & f > 0 \\ 0, & f = 0 \\ -1, & f < 0 \end{cases} sgn(f)=⎩ ⎨ ⎧+1,0,−1,f>0f=0f<0
4. 希尔伯特变换的应用
- 信号包络检测(用于振动分析、故障检测)
- 调制信号分析(提取 AM 信号的包络)
- 瞬时频率分析(语音、心率变异性分析)
- 时频分析(希尔伯特-黄变换 HHT)
5. Python 实现希尔伯特变换
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import hilbert
fs = 1000 # 采样率
t = np.linspace(0, 1, fs, endpoint=False)
carrier = np.cos(2 * np.pi * 10 * t) # 10 Hz 载波
modulation = 1 + 0.5 * np.sin(2 * np.pi * 1 * t) # 1Hz 低频调制
signal = modulation * carrier # AM 调制信号
analytic_signal = hilbert(signal)
amplitude_envelope = np.abs(analytic_signal) # 瞬时幅值
instantaneous_phase = np.unwrap(np.angle(analytic_signal)) # 瞬时相位
instantaneous_frequency = np.diff(instantaneous_phase) * fs / (2.0 * np.pi) # 瞬时频率
plt.figure(figsize=(10, 6))
plt.subplot(3,1,1)
plt.plot(t, signal, label="Original Signal")
plt.plot(t, amplitude_envelope, label="Envelope", linestyle="dashed")
plt.legend()
plt.title("Signal and Envelope")
plt.subplot(3,1,2)
plt.plot(t, instantaneous_phase, label="Instantaneous Phase", color="g")
plt.legend()
plt.title("Instantaneous Phase")
plt.subplot(3,1,3)
plt.plot(t[:-1], instantaneous_frequency, label="Instantaneous Frequency", color="r")
plt.legend()
plt.title("Instantaneous Frequency")
plt.tight_layout()
plt.show()
6. 结论
- 希尔伯特变换是一种 相移变换,构造解析信号以提取瞬时信息。
- 可用于 包络检测、调制分析、瞬时频率计算和时频分析。
- 在 语音、通信、振动分析、生物医学信号处理 等领域有广泛应用。