python实现阵列信号处理(二):基于波束形成空间谱

文章目录

  • 一、概述
  • 二、空间谱估计原理
    • 2.1 基于波束形成的空间谱估计原理
    • 2.2 常规波束形成的空间谱估计
    • 2.3 最小方差波束形成方法
  • 三、python语言实现波束形成
  • 四、Tips

一、概述

  常规空间谱估计就是扫描整个方位的方向矢量, 由其输出的幅度与方位关系可得到空间幅度谱, 多快拍输出的平均功率就是空间功率谱。常规波束形成方法分辨 率较低, 但同时也具有运算量低、稳健性高、不需要目标信号先验知识等优点, 因而仍然得到广泛运用。

二、空间谱估计原理

2.1 基于波束形成的空间谱估计原理

  阵列加权后相加输出为
y ( t ) = ⟨ w , x ( t ) ⟩ (2.1) \boldsymbol{y}(t)=\langle\boldsymbol{w}, \boldsymbol{x}(t)\rangle\tag {2.1} y(t)=w,x(t)(2.1)

  为了接收某一方向 θ 0 \theta_0 θ0 的信号 s 0 ( t ) s_0(t) s0(t), 抑制其他方向信 号, 也就是形成指向 θ 0 \theta_0 θ0 主波束, 需找一个权值矢量 w \boldsymbol{w} w, 使波束指向 θ 0 \theta_0 θ0, 从而加权后相加为此方向期望信号 s 0 ( t ) s_0(t) s0(t), 以抑制其他信号。

  当满足条件的权值 w w w 找到后, 可以得到波束指向 θ 0 \theta_0 θ0 时输出功率, 即:

P ( w ) = E [ ∣ y ( t ) ∣ 2 ] = E [ y ( t ) y H ( t ) ] = E [ w H x ( t ) ( w H x ( t ) ) H ] = w H R x w (2.2) \begin{aligned} P(\boldsymbol{w})=& E\left[|\boldsymbol{y}(t)|^2\right]=E\left[\boldsymbol{y}(t) \boldsymbol{y}^{\mathrm{H}}(t)\right]=\\ & E\left[\boldsymbol{w}^{\mathrm{H}} \boldsymbol{x}(t)\left(\boldsymbol{w}^{\mathrm{H}} \boldsymbol{x}(t)\right)^{\mathrm{H}}\right]=\boldsymbol{w}^{\mathrm{H}} \boldsymbol{R}_x \boldsymbol{w} \tag {2.2} \end{aligned} P(w)=E[y(t)2]=E[y(t)yH(t)]=E[wHx(t)(wHx(t))H]=wHRxw(2.2)

  因为 w \boldsymbol{w} w 是指向 θ 0 \theta_0 θ0 的权值, 因此一定与方向 θ 0 \theta_0 θ0 相关, 上式变为:

P ( θ 0 ) = w H ( θ 0 ) R x w ( θ 0 ) (2.3) P\left(\theta_0\right)=\boldsymbol{w}^{\mathrm{H}}\left(\theta_0\right) \boldsymbol{R}_x \boldsymbol{w}\left(\theta_0\right)\tag {2.3} P(θ0)=wH(θ0)Rxw(θ0)(2.3)

2.2 常规波束形成的空间谱估计

  常规波束形成器中取 w = a ( θ 0 ) \boldsymbol{w}=\boldsymbol{a}\left(\theta_0\right) w=a(θ0), 那么可以得到常规波束形成时的空间功率谱为:

P ( θ ) = a H ( θ ) R x a ( θ ) (2.4) P(\theta)=\boldsymbol{a}^{\mathrm{H}}(\theta) \boldsymbol{R}_x \boldsymbol{a}(\theta) \tag {2.4} P(θ)=aH(θ)Rxa(θ)(2.4)

2.3 最小方差波束形成方法

  最小方差法是 Capon 于 1969 年提出的, 也称为基于 Capon 的滤波方法。首先,阵列信号接收模型可表示为:

x ( t ) = s 0 ( t ) a ( θ 0 ) + n ( t ) (2.5) \boldsymbol{x}(t)=s_0(t) \boldsymbol{a}\left(\theta_0\right)+\boldsymbol{n}(t) \tag {2.5} x(t)=s0(t)a(θ0)+n(t)(2.5)

  在波束形成中, 寻找加权矢量 w \boldsymbol{w} w, 从阵列快拍 x ( t ) \boldsymbol{x}(t) x(t) 中恢复出信号 s 0 ( t ) s_0(t) s0(t) 为:

s 0 ( t ) = ⟨ w , x ( t ) ⟩ = ⟨ w , s 0 ( t ) a ( θ 0 ) + n ( t ) ⟩ = s 0 ( t ) w H a ( θ 0 ) + w H n ( t ) (2.6) \boldsymbol{s}_0(t)=\langle\boldsymbol{w}, \boldsymbol{x}(t)\rangle=\left\langle\boldsymbol{w}, s_0(t) \boldsymbol{a}\left(\theta_0\right)+\boldsymbol{n}(t)\right\rangle= s_0(t) \boldsymbol{w}^{\mathrm{H}} \boldsymbol{a}\left(\theta_0\right)+\boldsymbol{w}^{\mathrm{H}} \boldsymbol{n}(t)\tag {2.6} s0(t)=w,x(t)=w,s0(t)a(θ0)+n(t)=s0(t)wHa(θ0)+wHn(t)(2.6)

  从上面的式子可以看出, 当 w H a ( θ 0 ) = 1 \boldsymbol{w}^{\mathrm{H}} \boldsymbol{a}\left(\theta_0\right)=1 wHa(θ0)=1 时, 可以恢复出信号 s 0 ( t ) s_0(t) s0(t)

  计算以下方差:

E [ ∣ s 0 ( t ) − E [ s 0 ( t ) ] ∣ 2 ] = E [ ∣ s 0 ( t ) ∣ 2 ] − ∣ E [ s 0 ( t ) ] ∣ 2 = E [ ∣ s 0 ( t ) ∣ 2 ] − ∣ s 0 ( t ) ∣ 2 (2.7) \begin{aligned} E\left[\left|s_0(t)-E\left[s_0(t)\right]\right|^2\right]=& E\left[\left|s_0(t)\right|^2\right]-\left|E\left[s_0(t)\right]\right|^2=\\ & E\left[\left|s_0(t)\right|^2\right]-\left|s_0(t)\right|^2 \end{aligned}\tag {2.7} E[s0(t)E[s0(t)]2]=E[s0(t)2]E[s0(t)]2=E[s0(t)2]s0(t)2(2.7)

  在估计理论中可知, 估计方差最小的估计为最优估计, 即:

min ⁡ w E [ ∣ s 0 ( t ) − E [ s 0 ( t ) ] ∣ 2 ] (2.8) \min _w E\left[\left|s_0(t)-E\left[s_0(t)\right]\right|^2\right] \tag {2.8} wminE[s0(t)E[s0(t)]2](2.8)

  上式等效为:

min ⁡ w E [ ∣ s 0 ( t ) ∣ 2 ] = min ⁡ w E [ w H x ( t ) x H ( t ) w ] = min ⁡ w w H R x w (2.9) \min _w E\left[\left|\boldsymbol{s}_0(t)\right|^2\right]=\min _w E\left[\boldsymbol{w}^{\mathrm{H}} \boldsymbol{x}(t) \boldsymbol{x}^{\mathrm{H}}(t) \boldsymbol{w}\right]=\min _{\boldsymbol{w}} \boldsymbol{w}^{\mathrm{H}} \boldsymbol{R}_x \boldsymbol{w}\tag {2.9} wminE[s0(t)2]=wminE[wHx(t)xH(t)w]=wminwHRxw(2.9)

  经过最小二乘法变换,最终可以得到如下结果:

w o p t = R x − 1 a ( θ 0 ) a H ( θ 0 ) R x − 1 a ( θ 0 ) (2.10) \boldsymbol{w}_{\mathrm{opt}}=\frac{\boldsymbol{R}_x^{-1} \boldsymbol{a}\left(\theta_0\right)}{\boldsymbol{a}^{\mathrm{H}}\left(\theta_0\right) \boldsymbol{R}_x^{-1} \boldsymbol{a}\left(\theta_0\right)}\tag {2.10} wopt=aH(θ0)Rx1a(θ0)Rx1a(θ0)(2.10)

  阵列的输出功率为:

P ( θ ) = 1 a H ( θ ) R x − 1 a ( θ ) (2.11) P(\theta)=\frac{1}{\boldsymbol{a}^{\mathrm{H}}(\theta) \boldsymbol{R}_x^{-1} \boldsymbol{a}(\theta)}\tag {2.11} P(θ)=aH(θ)Rx1a(θ)1(2.11)

  由于不知道来波方向, 可对整个方向上扫描得到谱线, 谱线峰值对应方向即为来波方向。

三、python语言实现波束形成

# 导入模块
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
# 生成快拍数据
def gen_signal(fre, t_0, theta, speed, numbers, space):
    res = []
    for i in range(numbers):
        res.append(np.exp(2j*np.pi*fre*t_0 + 2j*np.pi*fre*i*space*np.sin(theta)/speed))
    return np.array(res)

# 生成方向矢量
def steer_vector(fre, theta, speed, numbers, sapce):
    alphas = []
    for i in range(numbers):
        alphas.append(np.exp(2j*np.pi*fre*i*space*np.sin(theta)/speed))   
    return np.array(alphas).reshape(-1, 1)
 
# 计算空间谱
def cal_spectrum(fre, speed, numbers, space, signal):
    mags = []
    thetas = np.linspace(-np.pi/2, np.pi/2, 1800)
    for _theta in thetas:
        _alphas = steer_vector(fre, _theta, speed, numbers, space)
        projection = np.matmul(np.conjugate(_alphas).T, signal.reshape(-1, 1))
        mags.append(projection[0][0])
    mags = np.array(mags)
    return thetas/np.pi*180, mags

# 计算空间谱功率
def cal_P(fre, speed, numbers, space, signals):
    R_x = np.matmul(signals, np.conjugate(signals.T)) / signals.shape[1]
    P = []
    thetas = np.linspace(-np.pi/2, np.pi/2, 1800)
    for _theta in thetas:
        _alphas = steer_vector(fre, _theta, speed, numbers, space).reshape(-1, 1)
        P_x = np.matmul(np.matmul(np.conjugate(_alphas.T), R_x), _alphas)
        P.append(P_x[0][0])
    P = np.array(P)
    return thetas/np.pi*180, P

# 最小二乘法计算空间谱
def cal_capon(fre, speed, numbers, space, signals):
    R_x = np.matmul(signals, np.conjugate(signals.T)) / signals.shape[1]
    inv = np.linalg.pinv(R_x)
    P = []
    thetas = np.linspace(-np.pi/2, np.pi/2, 1800)
    for _theta in thetas:
        _alphas = steer_vector(fre, _theta, speed, numbers, space).reshape(-1, 1)
        P_x = 1 / np.matmul(np.matmul(np.conjugate(_alphas.T), inv), _alphas)
        P.append(P_x)
    P = np.array(P).flatten()
    return thetas/np.pi*180, P

# 初始化数据
fs = 20000
# 定义源信号
fre = 100
t = np.arange(0, 0.01, 1/fs)
theta1 = -np.pi / 6
theta2 = np.pi / 3
# 传播速度
speed = 340
# 阵元数量
numbers = 32
# 阵元之间距离
space = 1
# 生成模拟快拍数据
signals = []
for t_0 in t:
    signal1 = gen_signal(fre, t_0, theta1, speed, numbers, space)
    signal2 = gen_signal(fre, t_0, theta2, speed, numbers, space)
    signal = signal1 + signal2
    signals.append(signal.tolist())
signals = np.array(signals).T

# 计算空间谱功率
thetas, P = cal_P(fre, speed, numbers, space, signals)
plt.figure(figsize=(10, 2))
plt.plot(thetas, abs(P))
plt.xlim(-90, 90)
plt.xlabel('degree')
plt.ylabel('mag')
plt.show()

# 最小方差波速形成
thetas, P = cal_capon(fre, speed, numbers, space, signals)
plt.figure(figsize=(10, 2))
plt.plot(thetas, abs(P))
plt.xlim(-90, 90)
plt.xlabel('degree')
plt.ylabel('mag')
plt.show()

python实现阵列信号处理(二):基于波束形成空间谱_第1张图片

图3.1 最小方差波速形成结果

四、Tips

  文中如有错误或不清晰的地方,敬请谅解,可留言指出,笔者将及时答复、更改,希望共同进步,谢谢支持。

你可能感兴趣的:(python实现阵列信号处理,python,信号处理,人工智能)