自适应波束成形方法提升海洋和风电场杂波中被动雷达性能

高斯模型混合模型–理论上可以拟合任意概率密度分布 阅读详情

1. 引言

无源雷达利用环境中已有的电磁照射源(如数字电视广播、调频广播、移动通信基站、卫星导航信号等)探测目标,自身不发射电磁能量,具备隐蔽性高、成本低廉、抗反辐射攻击等优势。海上目标探测与沿海监视应用中,无源雷达面临复杂杂波环境的严峻挑战:海面后向散射产生的海杂波具有非高斯统计特性,而近海风电场中旋转的风力涡轮机产生独特的微多普勒调制效应,二者共同构成强杂波背景,严重制约目标检测性能。

自适应波束成形技术通过空域滤波抑制特定方向杂波,结合时域多普勒处理实现空时二维滤波,成为提升无源雷达在复杂杂波环境下检测能力的关键技术途径。该技术依据杂波统计特性实时调整阵列权重,在保护目标信号增益的同时,最大化抑制海杂波与风电场杂波。


2. 无源雷达机会照射源与双基地几何

2.1 机会照射源特性分析

无源雷达依赖第三方发射机提供照射。常用机会照射源包括DVB-T(地面数字电视广播,频段470-862 MHz)、DAB(数字音频广播,174-240 MHz)、FM广播(88-108 MHz)及4G/5G通信基站(700 MHz-3.5 GHz)。这些信号具有连续波特性,带宽从100 kHz(FM)到8 MHz(DVB-T)不等,影响距离分辨率。

照射信号带宽 $B$ 决定距离分辨率:

$$\Delta R = \frac{c}{2B \cos(\beta/2)}$$

其中 $\beta$ 为双基地角,$c$ 为光速。信号调制方式决定模糊函数特性,OFDM信号具有图钉状模糊函数,适合精确测距。

2.2 双基地雷达方程与覆盖范围

无源雷达为双基地体制,发射机与接收机分置。接收功率由双基地雷达方程描述:

$$P_r = \frac{P_t G_t G_r \lambda^2 \sigma_b}{(4\pi)^3 R_t^2 R_r^2 L}$$

其中 $P_t$ 为发射功率,$G_t$ 与 $G_r$ 分别为发射与接收天线增益,$R_t$ 与 $R_r$ 分别为目标到发射机与接收机的距离,$\sigma_b$ 为双基地雷达散射截面积,$L$ 为系统损耗。

等椭圆线定义为 $R_t + R_r = \text{const}$,接收机位于椭圆焦点之一。覆盖范围受限于发射机功率、接收机灵敏度及目标双基地RCS。

2.3 直达波与目标回波路径差异

接收机同时接收直达波(Direct Path Signal, DPS)与目标反射波。直达波功率远高于目标回波,通常强 $60-100 \text{ dB}$。直达波可用作参考信号进行相干检测,但需通过空域滤波或对消技术防止其掩盖微弱目标信号。

路径差异导致时间延迟 $\tau$ 与多普勒频移 $f_d$ 不同。对于静止发射机与接收机,目标引起的多普勒频移为:

$$f_d = \frac{1}{\lambda}[\mathbf{v} \cdot (\hat{\mathbf{i}} + \hat{\mathbf{r}})]$$

其中 $\mathbf{v}$ 为目标速度矢量,$\hat{\mathbf{i}}$ 与 $\hat{\mathbf{r}}$ 分别为入射与反射方向单位矢量。


3. 海杂波统计与频谱特性

3.1 海面散射物理机制

海杂波源于海面粗糙表面对电磁波的 Bragg 散射与杂散散射。Bragg 散射由与雷达波长匹配的海面毛细波产生,散射强度与海面粗糙度、风速、风向相关。对于双基地配置,Bragg 频率偏移量为:

$$f_B = \pm \sqrt{\frac{g}{\pi \lambda}} \cos\delta$$

其中 $g$ 为重力加速度,$\delta$ 为双基地角的一半,正负号对应朝向或远离雷达传播方向的海浪分量。

3.2 K分布与复合高斯模型

海杂波幅度统计服从K分布,适用于高分辨率雷达与低擦地角情况。K分布为复合分布,描述为:

$$p(x) = \frac{2b}{\Gamma(\nu)} \left( \frac{bx}{2} \right)^\nu K_{\nu-1}(bx), x \geq 0$$

其中 $\nu$ 为形状参数,控制分布拖尾程度($\nu \to \infty$ 退化为瑞利分布),$b$ 为尺度参数,$K_{\nu-1}$ 为第二类修正贝塞尔函数。复合高斯模型将杂波表示为慢变纹理分量与快变散斑分量的乘积,纹理分量服从伽马分布,反映海表面局部起伏。

3.3 多普勒频谱展宽特性

海杂波多普勒频谱由平台运动与海表面运动共同决定。固定平台条件下,海杂波多普勒扩展源于海浪运动,频谱中心位于Bragg频率,展宽取决于风速与浪高。频谱可建模为双高斯或洛伦兹线型:

$$S(f) = \frac{A_i}{1 + (\frac{f-f_{Bi}}{\sigma_i})^2}$$

其中 $f_{Bi}$ 为Bragg峰频率,$\sigma_i$ 为谱宽参数。自适应波束成形需考虑此非对称频谱特性,设计窄带或宽带陷波滤波器。


4. 风电场杂波微多普勒模型

4.1 风力涡轮机电磁散射机理

风力涡轮机由塔筒、机舱与旋转叶片组成,构成复杂电磁散射体。叶片通常为玻璃纤维复合材料外包金属防雷导线,长度 20-80 米,旋转速度 10-30 RPM。叶片旋转引入时变散射中心,产生微多普勒效应。

双基地配置下,叶片上某点 $P$ 的瞬时多普勒频移取决于其旋转速度与双基地几何关系:

$$f_{micro}(t) = \frac{2L\Omega}{\lambda} \cos\theta(t) \cos(\beta/2)$$

其中 $L$ 为叶片长度,$\Omega$ 为角速度,$\theta(t)$ 为叶片瞬时角度,$\beta$ 为双基地角。微多普勒频谱呈正弦调制特征,频谱宽度可达数百赫兹。

4.2 叶片旋转微多普勒特征

单台风机产生呈"蝴蝶"状的微多普勒谱图,周期对应叶片旋转周期。三叶片风机每隔 $120^\circ$ 出现散射峰值,时频分析显示周期性闪烁。多台风机形成非平稳、非高斯的多扩展杂波环境。

微多普勒信号数学模型表示为:

$$s_{wf}(t) = \sum_{k=1}^{N_b} A_k(t) e^{j\phi_k(t)}$$

其中 $N_b$ 为叶片数量,$A_k(t)$ 为时变幅度(由RCS调制决定),$\phi_k(t) = 2\pi \int f_{micro,k}(\tau) d\tau$ 为瞬时相位。

4.3 时变非平稳杂波建模

风电场杂波具有非平稳特性,需采用时变自适应处理。杂波协方差矩阵在短时段内近似平稳,但长期统计特性变化显著。分段自适应处理将数据划分为若干相干处理间隔(CPI),每段内假设杂波平稳,段间更新权重。

空时自适应处理(STAP)扩展至时变环境,通过训练样本选择或知识辅助方法补偿非平稳性。对角加载技术增强协方差矩阵估计稳健性:

$$\hat{\mathbf{R}}_{dl} = \hat{\mathbf{R}} + \sigma_{dl}^2 \mathbf{I}$$

其中 $\sigma_{dl}^2$ 为加载水平,通常取噪声功率的 5-10 倍。


5. 自适应波束成形理论基础

5.1 空时采样数据结构

无源雷达阵列接收机采集空时二维数据。设有 $N$ 个阵元,每个阵元采集 $M$ 个脉冲或时间样本,形成 $NM \times 1$ 数据矢量 $\mathbf{x}$。空时导向矢量 $\mathbf{s}$ 描述目标在特定方向与多普勒频率的响应:

$$\mathbf{s} = \mathbf{s}_t \otimes \mathbf{s}_s$$

其中 $\mathbf{s}_t$ 为时域导向矢量(多普勒 steering vector),$\mathbf{s}_s$ 为空域导向矢量,$\otimes$ 为Kronecker积。对于被动雷达连续波照射,时域采样对应于不同延迟或连续时间快照。空时数据矩阵 $\mathbf{X}$ 维度为 $N \times M$。

5.2 最优滤波器理论

自适应波束成形权矢量 $\mathbf{w}$ 通过优化准则确定。最小方差无失真响应(MVDR)准则最小化输出功率同时约束目标方向增益:

$$\min_{\mathbf{w}} \mathbf{w}^H \mathbf{R} \mathbf{w} \quad \text{subject to} \quad \mathbf{w}^H \mathbf{s} = 1$$

解析解为:

$$\mathbf{w}_{MVDR} = \frac{\mathbf{R}^{-1}\mathbf{s}}{\mathbf{s}^H \mathbf{R}^{-1} \mathbf{s}}$$

线性约束最小方差(LCMV)扩展至多约束,可同时约束目标方向增益与杂波方向零陷:

$$\min_{\mathbf{w}} \mathbf{w}^H \mathbf{R} \mathbf{w} \quad \text{subject to} \quad \mathbf{C}^H \mathbf{w} = \mathbf{f}$$

其中 $\mathbf{C}$ 为约束矩阵,包含目标与杂波方向导向矢量,$\mathbf{f}$ 为约束响应矢量。

5.3 协方差矩阵估计与对角加载

样本协方差矩阵由训练样本估计:

$$\hat{\mathbf{R}} = \frac{1}{K} \sum_{k=1}^{K} \mathbf{x}_k \mathbf{x}_k^H$$

$K$ 为训练样本数,需满足 $K \ge 2N$ 以保证矩阵可逆。海杂波与风电场杂波非均匀性导致训练样本选择困难,需采用样本筛选或知识辅助方法。

对角加载改善小样本条件下的矩阵病态问题:

$$\mathbf{w}_{dl} = \frac{(\hat{\mathbf{R}} + \sigma_{dl}^2 \mathbf{I})^{-1} \mathbf{s}}{\mathbf{s}^H (\hat{\mathbf{R}} + \sigma_{dl}^2 \mathbf{I})^{-1} \mathbf{s}}$$

加载水平 $\sigma_{dl}^2$ 通常取接收机噪声功率的 5-10 dB。


6. 空时自适应处理框架

6.1 空时导向矢量构造

空时自适应处理联合利用空域与多普勒域自由度。空域导向矢量 $\mathbf{a}(\theta)$ 描述阵列对方向 $\theta$ 的响应:

$$\mathbf{a}(\theta) = [1, e^{j \frac{2\pi d}{\lambda} \sin\theta}, \dots, e^{j \frac{2\pi d}{\lambda} (N-1) \sin\theta}]^T$$

时域导向矢量 $\mathbf{b}(f_d)$ 对应多普勒频率 $f_d$:

$$\mathbf{b}(f_d) = [1, e^{j 2\pi f_d T_r}, \dots, e^{j 2\pi f_d (M-1) T_r}]^T$$

其中 $T_r$ 为脉冲重复间隔或采样间隔。空时导向矢量为:

$$\mathbf{v}(\theta, f_d) = \mathbf{b}(f_d) \otimes \mathbf{a}(\theta)$$

维度为 $NM \times 1$。

6.2 降维STAP处理方法

全维STAP计算复杂度为 $O((NM)^3)$,难以实时实现。降维方法通过变换矩阵 $\mathbf{T}$ 将数据投影至低维子空间:

$$\mathbf{y} = \mathbf{T}^H \mathbf{x}, \quad \mathbf{R}_y = \mathbf{T}^H \mathbf{R} \mathbf{T}$$

常用降维策略包括:

  • 空时主成分分析(ST-PCA):选取杂波协方差矩阵主特征矢量。

  • 联合域局部化(JDL):在角度-多普勒平面局部区域处理。

  • 参数化自适应匹配滤波(PAMF):利用AR模型降维。

    自适应匹配滤波(AMF)检测统计量:

    $$\Lambda = \frac{|\mathbf{w}^H \mathbf{x}|^2}{\mathbf{w}^H \mathbf{R} \mathbf{w}} \mathop{\gtrless}_{H_0}^{H_1} \eta$$

    其中 $\mathbf{w} = \mathbf{R}^{-1} \mathbf{v}$。

6.3 知识辅助自适应处理

利用环境先验知识改善非均匀杂波环境中的自适应处理性能。知识辅助STAP(KA-STAP)结合杂波协方差矩阵先验估计 $\mathbf{R}_{prior}$ 与样本估计:

$$\hat{\mathbf{R}}_{KA} = \alpha \mathbf{R}_{prior} + (1-\alpha) \hat{\mathbf{R}}$$

权重 $\alpha$ 反映先验知识置信度。先验知识来源于地形数据库、海况模型或风电场布局图,用于预测杂波角度-多普勒分布。


7. 参考信号分离与杂波抑制策略

7.1 直达波提取与净化

无源雷达需要高保真参考信号进行相干检测。接收通道通过高增益参考天线或波束成形指向发射机,提取直达波。参考通道与监测通道隔离度决定杂波泄漏水平。

自适应波束成形在参考通道形成零陷抑制多径干扰,在监测通道抑制直达波与杂波。参考信号重建通过数字波束成形实现:

$$\hat{s}_{ref}(t) = \mathbf{w}_{ref}^H \mathbf{x}(t)$$

其中 $\mathbf{w}_{ref}$ 为参考波束权重,通常采用约束波束成形指向发射机方向。

7.2 杂波子空间投影消除

杂波子空间投影方法利用杂波协方差矩阵的特征结构。对 $\mathbf{R}$ 进行特征分解:

$$\mathbf{R} = \sum_{i=1}^{NM} \lambda_i \mathbf{e}_i \mathbf{e}_i^H$$

大特征值对应的特征矢量张成杂波子空间,小特征值对应噪声子空间。投影矩阵消除杂波分量:

$$\mathbf{P}_\perp = \mathbf{I} - \sum_{i=1}^{N_c} \mathbf{e}_i \mathbf{e}_i^H$$

其中 $N_c$ 为杂波子空间维数。波束成形权重投影后抑制杂波:

$$\mathbf{w}_{proj} = \mathbf{P}_\perp \mathbf{w}_{conventional}$$

7.3 恒虚警检测门限设定

自适应处理后采用CFAR检测确定目标存在。检测统计量经平方律检波后与自适应门限比较。门限由保护窗与训练窗内的杂波水平估计确定:

$$\hat{\mu} = \frac{1}{K} \sum_{k \in \Omega} |z_k|^2$$

$$\eta = \alpha \hat{\mu}$$

其中 $\Omega$ 为训练窗样本集,$\alpha$ 为阈值乘子,由虚警概率 $P_{fa}$ 确定。对于K分布杂波,需采用对数CFAR或基于ML的检测器。


第二部分:代码实现

脚本1: 无源雷达双基地几何与覆盖分析

脚本功能:
实现无源雷达双基地几何建模,计算等距离椭圆与等多普勒线,分析机会照射源覆盖范围。可视化发射机-接收机-目标几何关系。

使用方式:
配置发射机与接收机坐标,运行脚本生成双基地覆盖图与距离-多普勒单元格。

"""
Script 1: Passive Radar Bistatic Geometry and Coverage Analysis
Author: J Rosado-Sanz, MP Jarabo-Amores Implementation
Description: Bistatic geometry modeling for passive radar systems
"""

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
from matplotlib.collections import LineCollection

class BistaticGeometry:
    """Model bistatic radar geometry for passive radar"""
    
    def __init__(self, tx_pos, rx_pos, wavelength=1.0):
        """
        Initialize bistatic geometry
        
        Parameters:
        -----------
        tx_pos : ndarray (2,)
            Transmitter position [x, y] in km
        rx_pos : ndarray (2,)
            Receiver position [x, y] in km
        wavelength : float
            Signal wavelength
        """
        self.tx = np.array(tx_pos)
        self.rx = np.array(rx_pos)
        self.lambda_ = wavelength
        self.baseline = np.linalg.norm(self.tx - self.rx)
        
    def bistatic_range(self, target_pos):
        """Calculate bistatic range (sum of distances)"""
        target = np.array(target_pos)
        Rt = np.linalg.norm(target - self.tx)
        Rr = np.linalg.norm(target - self.rx)
        return Rt + Rr
    
    def bistatic_angle(self, target_pos):
        """Calculate bistatic angle at target"""
        target = np.array(target_pos)
        vec_t = self.tx - target
        vec_r = self.rx - target
        
        cos_beta = np.dot(vec_t, vec_r) / (np.linalg.norm(vec_t) * np.linalg.norm(vec_r))
        return np.arccos(np.clip(cos_beta, -1, 1))
    
    def doppler_shift(self, target_pos, target_vel, carrier_freq):
        """
        Calculate bistatic Doppler shift
        
        Parameters:
        -----------
        target_pos : ndarray (2,)
        target_vel : ndarray (2,)
            Target velocity vector [vx, vy] in m/s
        carrier_freq : float
            Carrier frequency in Hz
        """
        target = np.array(target_pos)
        vel = np.array(target_vel)
        
        # Unit vectors
        u_tx = (self.tx - target) / np.linalg.norm(self.tx - target)
        u_rx = (self.rx - target) / np.linalg.norm(self.rx - target)
        
        # Bistatic Doppler
        c = 3e8  # Speed of light
        fd = (carrier_freq / c) * np.dot(vel, u_tx + u_rx)
        return fd
    
    def range_isolines(self, area_extent, n_lines=10):
        """
        Generate range sum isolines (ellipses)
        
        Returns:
        --------
        isolines : list of Ellipse patches
        """
        isolines = []
        max_range = self.baseline * 3
        
        for r in np.linspace(self.baseline * 1.1, max_range, n_lines):
            # Ellipse parameters: foci at tx and rx
            a = r / 2  # Semi-major axis
            c = self.baseline / 2  # Focal distance
            b = np.sqrt(max(0, a**2 - c**2))  # Semi-minor axis
            
            # Ellipse center
            center = (self.tx + self.rx) / 2
            
            # Rotation angle
            angle = np.degrees(np.arctan2(self.rx[1] - self.tx[1], 
                                       self.rx[0] - self.tx[0]))
            
            ellipse = Ellipse(center, 2*a, 2*b, angle=angle, 
                           fill=False, color='blue', alpha=0.6, linewidth=1)
            isolines.append(ellipse)
        
        return isolines, max_range
    
    def coverage_analysis(self, Pt_dBm, Gt_dBi, Gr_dBi, 
                       noise_fig_dB, bw_hz, loss_dB=6):
        """
        Calculate bistatic coverage based on radar equation
        
        Parameters:
        -----------
        Pt_dBm : float
            Transmitter power
        Gt_dBi, Gr_dBi : float
            Antenna gains
        noise_fig_dB : float
            Receiver noise figure
        bw_hz : float
            Signal bandwidth
        loss_dB : float
            System losses
            
        Returns:
        --------
        coverage_grid : ndarray
            SNR coverage map
        """
        # Grid setup
        x = np.linspace(min(self.tx[0], self.rx[0]) - 50, 
                       max(self.tx[0], self.rx[0]) + 50, 100)
        y = np.linspace(min(self.tx[1], self.rx[1]) - 50, 
                       max(self.tx[1], self.rx[1]) + 50, 100)
        X, Y = np.meshgrid(x, y)
        
        # Calculate bistatic ranges for each point
        Rt = np.sqrt((X - self.tx[0])**2 + (Y - self.tx[1])**2)
        Rr = np.sqrt((X - self.rx[0])**2 + (Y - self.rx[1])**2)
        
        # Radar equation (simplified for plotting)
        # SNR proportional to 1/(Rt^2 * Rr^2)
        k = 1.38e-23  # Boltzmann constant
        T0 = 290  # Standard temperature
        noise_power = k * T0 * bw_hz * 10**(noise_fig_dB/10)
        
        # Assuming sigma=1 for relative coverage
        Pr = Pt_dBm + Gt_dBi + Gr_dBi - loss_dB \
             - 20*np.log10(Rt*1e3) - 20*np.log10(Rr*1e3) \
             - 20*np.log10(4*np.pi/self.lambda_)
        
        SNR = Pr - 10*np.log10(noise_power)
        
        return X, Y, SNR
    
    def plot_geometry(self, targets=None):
        """Visualize bistatic geometry"""
        fig, ax = plt.subplots(figsize=(12, 10))
        
        # Plot transmitter and receiver
        ax.scatter(*self.tx, c='red', s=200, marker='^', 
                  label='Transmitter', zorder=5, edgecolors='black')
        ax.scatter(*self.rx, c='blue', s=200, marker='s', 
                  label='Receiver', zorder=5, edgecolors='black')
        
        # Baseline
        ax.plot([self.tx[0], self.rx[0]], [self.tx[1], self.rx[1]], 
               'k--', linewidth=2, label='Baseline')
        
        # Range isolines
        isolines, _ = self.range_isolines(None, n_lines=8)
        for ellipse in isolines:
            ax.add_patch(ellipse)
        
        # Plot targets if provided
        if targets is not None:
            for i, tgt in enumerate(targets):
                ax.scatter(*tgt['pos'], c='green', s=150, marker='o', 
                          label=f'Target {i+1}' if i == 0 else "")
                
                # Draw lines to Tx and Rx
                ax.plot([self.tx[0], tgt['pos'][0]], [self.tx[1], tgt['pos'][1]], 
                       'g:', alpha=0.5)
                ax.plot([self.rx[0], tgt['pos'][0]], [self.rx[1], tgt['pos'][1]], 
                       'g:', alpha=0.5)
        
        ax.set_xlabel('X (km)')
        ax.set_ylabel('Y (km)')
        ax.set_title('Bistatic Radar Geometry')
        ax.legend()
        ax.grid(True, alpha=0.3)
        ax.set_aspect('equal')
        
        return fig, ax

def demo_bistatic_geometry():
    """Demonstrate bistatic geometry analysis"""
    print("=" * 60)
    print("Passive Radar Bistatic Geometry Analysis")
    print("=" * 60)
    
    # Setup: FM transmitter and coastal receiver
    tx_pos = [0, 0]  # Transmitter at origin
    rx_pos = [50, 0]  # Receiver 50km east
    
    geo = BistaticGeometry(tx_pos, rx_pos, wavelength=3.0)  # 100 MHz
    
    # Target scenario
    targets = [
        {'pos': [30, 20], 'vel': [50, 30]},  # Target 1
        {'pos': [25, -15], 'vel': [-20, 40]}  # Target 2
    ]
    
    # Calculate parameters for targets
    print("Target Analysis:")
    for i, tgt in enumerate(targets):
        R_bi = geo.bistatic_range(tgt['pos'])
        beta = np.degrees(geo.bistatic_angle(tgt['pos']))
        fd = geo.doppler_shift(tgt['pos'], tgt['vel'], 100e6)
        
        print(f"  Target {i+1} at ({tgt['pos'][0]}, {tgt['pos'][1]}) km:")
        print(f"    Bistatic range: {R_bi:.1f} km")
        print(f"    Bistatic angle: {beta:.1f}°")
        print(f"    Doppler shift: {fd:.2f} Hz")
    
    # Coverage analysis
    X, Y, SNR = geo.coverage_analysis(Pt_dBm=80, Gt_dBi=10, Gr_dBi=12,
                                     noise_fig_dB=3, bw_hz=100e3)
    
    # Visualization
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 7))
    
    # Geometry plot
    geo.plot_geometry(targets=targets)
    ax1 = fig.axes[0]
    ax1.set_title('Bistatic Geometry with Targets')
    
    # Coverage plot
    im = ax2.contourf(X, Y, SNR, levels=20, cmap='jet')
    ax2.scatter(*tx_pos, c='red', s=200, marker='^')
    ax2.scatter(*rx_pos, c='blue', s=200, marker='s')
    plt.colorbar(im, ax=ax2, label='SNR (dB)')
    ax2.set_title('Coverage Analysis (SNR)')
    ax2.set_xlabel('X (km)')
    ax2.set_ylabel('Y (km)')
    
    plt.tight_layout()
    plt.savefig('bistatic_geometry.png', dpi=150, bbox_inches='tight')
    plt.show()

if __name__ == "__main__":
    demo_bistatic_geometry()
    print("\nVisualization file generated:")
    print("- bistatic_geometry.png")

脚本2: 海杂波统计生成与K分布模拟

脚本功能:
实现海杂波统计建模,包括K分布随机数生成、复合高斯模型、多普勒频谱模拟。考虑双基地几何下的Bragg散射特性。

使用方式:
配置海况参数(风速、风向),生成杂波时间序列与空域采样,可视化幅度统计分布与功率谱密度。

"""
Script 2: Sea Clutter Statistical Generation and K-Distribution Modeling
Author: J Rosado-Sanz, MP Jarabo-Amores Implementation
Description: Sea clutter simulation for passive radar environments
"""

import numpy as np
import matplotlib.pyplot as plt
from scipy.special import gamma as gamma_func
from scipy import signal

class SeaClutterModel:
    """K-distributed sea clutter with Doppler spectrum"""
    
    def __init__(self, shape_param=1.5, scale_param=2.0, 
                 bragg_freq=0.5, spectrum_width=0.1):
        """
        Initialize sea clutter model
        
        Parameters:
        -----------
        shape_param : float (nu)
            K-distribution shape parameter (lower = heavier tails)
        scale_param : float (b)
            Scale parameter
        bragg_freq : float
            Bragg frequency normalized to PRF or sampling rate
        spectrum_width : float
            Doppler spectrum width
        """
        self.nu = shape_param
        self.b = scale_param
        self.f_bragg = bragg_freq
        self.sigma_f = spectrum_width
        
    def generate_texture(self, n_samples):
        """
        Generate gamma-distributed texture component (slow varying)
        
        Returns:
        --------
        texture : ndarray
            Gamma-distributed samples with mean 1
        """
        # Gamma distribution with shape nu and scale 1/nu -> mean=1
        texture = np.random.gamma(self.nu, 1.0/self.nu, n_samples)
        return texture
    
    def generate_speckle(self, n_samples):
        """
        Generate complex Gaussian speckle (fast varying)
        """
        I = np.random.randn(n_samples)
        Q = np.random.randn(n_samples)
        return (I + 1j*Q) / np.sqrt(2)
    
    def generate_clutter(self, n_samples, correlated=True):
        """
        Generate K-distributed clutter sequence
        
        Parameters:
        -----------
        n_samples : int
        correlated : bool
            Apply temporal correlation based on Doppler spectrum
            
        Returns:
        --------
        clutter : ndarray (complex)
            K-distributed complex clutter
        """
        texture = self.generate_texture(n_samples)
        speckle = self.generate_speckle(n_samples)
        
        if correlated:
            # Apply Doppler spectrum shaping via filtering
            speckle = self._apply_doppler_spectrum(speckle)
        
        # Compound model: sqrt(texture) * speckle
        clutter = np.sqrt(texture) * speckle
        
        # Scale to desired level
        clutter = clutter * np.sqrt(self.b / 2)
        
        return clutter
    
    def _apply_doppler_spectrum(self, signal_in):
        """Apply Lorenzian Doppler spectrum shaping"""
        # Two Bragg lines + whitecap continuum
        n = len(signal_in)
        freqs = np.fft.fftfreq(n)
        
        # Spectrum model: two Bragg peaks + Gaussian background
        S_f = np.exp(-(freqs - self.f_bragg)**2 / (2*self.sigma_f**2)) + \
              np.exp(-(freqs + self.f_bragg)**2 / (2*self.sigma_f**2)) + \
              0.1 * np.exp(-freqs**2 / (2*(self.sigma_f*2)**2))
        
        # Normalize
        S_f = S_f / np.sqrt(np.sum(S_f**2))
        
        # Filter in frequency domain
        signal_fft = np.fft.fft(signal_in)
        signal_fft = signal_fft * np.sqrt(S_f)
        return np.fft.ifft(signal_fft)
    
    def theoretical_pdf(self, x):
        """Theoretical K-distribution PDF"""
        x = np.array(x)
        pdf = (2*self.b / gamma_func(self.nu)) * \
              (self.b*x/2)**(self.nu) * \
              np.exp(-self.b*x) * \
              np.exp(np.log(gamma_func(self.nu-1) + 1e-10))  # Modified Bessel approximation
        return pdf
    
    def spatial_correlation(self, distance, decorrelation_dist=100):
        """
        Spatial correlation function (exponential model)
        
        Parameters:
        -----------
        distance : float or ndarray
            Distance in meters
        decorrelation_dist : float
            Decorrelation distance
            
        Returns:
        --------
        rho : float or ndarray
            Correlation coefficient
        """
        return np.exp(-distance / decorrelation_dist)

def demo_sea_clutter():
    """Demonstrate sea clutter generation and analysis"""
    print("=" * 60)
    print("Sea Clutter Statistical Modeling")
    print("=" * 60)
    
    # Initialize model with moderate sea state
    clutter_model = SeaClutterModel(shape_param=1.0, scale_param=1.0,
                                     bragg_freq=0.2, spectrum_width=0.05)
    
    # Generate long sequence for statistics
    n_samples = 10000
    clutter = clutter_model.generate_clutter(n_samples, correlated=True)
    
    # Analysis
    amplitude = np.abs(clutter)
    phase = np.angle(clutter)
    
    print(f"Generated {n_samples} samples of K-distributed sea clutter")
    print(f"Amplitude mean: {np.mean(amplitude):.3f}")
    print(f"Amplitude std: {np.std(amplitude):.3f}")
    print(f"Shape parameter (estimated): {2/(np.mean(amplitude**2)/np.var(amplitude) - 1):.2f}")
    
    # Visualization
    fig, axes = plt.subplots(2, 2, figsize=(14, 10))
    
    # 1. Time series
    ax1 = axes[0, 0]
    ax1.plot(np.arange(500), amplitude[:500], linewidth=1)
    ax1.set_xlabel('Sample')
    ax1.set_ylabel('Amplitude')
    ax1.set_title('Sea Clutter Time Series (First 500 samples)')
    ax1.grid(True, alpha=0.3)
    
    # 2. PDF comparison
    ax2 = axes[0, 1]
    ax2.hist(amplitude, bins=50, density=True, alpha=0.7, 
            color='blue', edgecolor='black', label='Simulated')
    
    # Theoretical K-distribution (simplified plot)
    from scipy.stats import kappa4
    # Approximate with generalized distribution for visualization
    x_theory = np.linspace(0, np.percentile(amplitude, 99), 100)
    # Simple theoretical curve
    theory = (x_theory * clutter_model.nu * clutter_model.b)**clutter_model.nu * \
             np.exp(-clutter_model.b * x_theory) * 2
    theory = theory / np.max(theory) * np.max(np.histogram(amplitude, bins=50, density=True)[0])
    ax2.plot(x_theory, theory, 'r-', linewidth=2, label='K-dist (approx)')
    ax2.set_xlabel('Amplitude')
    ax2.set_ylabel('PDF')
    ax2.set_title('Amplitude Distribution')
    ax2.legend()
    ax2.grid(True, alpha=0.3)
    
    # 3. Doppler spectrum
    ax3 = axes[1, 0]
    f, Pxx = signal.welch(clutter, fs=1.0, nperseg=256, return_onesided=False)
    ax3.plot(np.fft.fftshift(f), 10*np.log10(np.fft.fftshift(Pxx)), linewidth=2)
    ax3.axvline(clutter_model.f_bragg, color='red', linestyle='--', 
               label='Bragg freq')
    ax3.axvline(-clutter_model.f_bragg, color='red', linestyle='--')
    ax3.set_xlabel('Normalized Frequency')
    ax3.set_ylabel('Power Spectral Density (dB)')
    ax3.set_title('Doppler Spectrum')
    ax3.legend()
    ax3.grid(True, alpha=0.3)
    
    # 4. Phase distribution
    ax4 = axes[1, 1]
    ax4.hist(phase, bins=50, density=True, alpha=0.7, color='green', edgecolor='black')
    ax4.set_xlabel('Phase (radians)')
    ax4.set_ylabel('PDF')
    ax4.set_title('Phase Distribution (should be uniform)')
    ax4.grid(True, alpha=0.3)
    
    plt.suptitle('Sea Clutter Statistical Characteristics', fontsize=14)
    plt.tight_layout()
    plt.savefig('sea_clutter_analysis.png', dpi=150, bbox_inches='tight')
    plt.show()

def generate_spatial_clutter():
    """Generate spatially correlated clutter for array processing"""
    print("\nGenerating spatially correlated clutter for array...")
    
    n_elements = 8
    n_samples = 1000
    d = 0.5  # Half wavelength spacing
    
    # Generate clutter for each element with spatial correlation
    clutter_spatial = np.zeros((n_elements, n_samples), dtype=complex)
    
    model = SeaClutterModel(shape_param=1.2, bragg_freq=0.15)
    
    # Generate independent components
    for i in range(n_elements):
        clutter_spatial[i, :] = model.generate_clutter(n_samples)
    
    # Apply spatial correlation
    # Correlation matrix based on distance
    R_spatial = np.zeros((n_elements, n_elements))
    for i in range(n_elements):
        for j in range(n_elements):
            dist = abs(i-j) * d
            R_spatial[i, j] = model.spatial_correlation(dist, decorrelation_dist=2.0)
    
    # Cholesky decomposition to correlate
    L = np.linalg.cholesky(R_spatial + 0.001*np.eye(n_elements))
    clutter_correlated = L @ clutter_spatial
    
    # Visualization
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 5))
    
    # Spatial correlation matrix
    im1 = ax1.imshow(np.abs(R_spatial), cmap='hot', aspect='auto')
    ax1.set_title('Spatial Correlation Matrix')
    ax1.set_xlabel('Element Index')
    ax1.set_ylabel('Element Index')
    plt.colorbar(im1, ax=ax1)
    
    # Range-Doppler map (simulated)
    # Create a simple RD map using the generated clutter
    rd_map = np.abs(clutter_correlated)**2
    im2 = ax2.imshow(10*np.log10(rd_map + 1e-10), aspect='auto', 
                    cmap='jet', origin='lower')
    ax2.set_title('Simulated Range-Doppler Map (Sea Clutter)')
    ax2.set_xlabel('Range Sample')
    ax2.set_ylabel('Doppler Bin')
    plt.colorbar(im2, ax=ax2, label='Power (dB)')
    
    plt.tight_layout()
    plt.savefig('spatial_sea_clutter.png', dpi=150, bbox_inches='tight')
    plt.show()

if __name__ == "__main__":
    demo_sea_clutter()
    generate_spatial_clutter()
    print("\nVisualization files generated:")
    print("- sea_clutter_analysis.png")
    print("- spatial_sea_clutter.png")

脚本3: 风电场微多普勒杂波建模

脚本功能:
实现风力涡轮机微多普勒效应建模,模拟叶片旋转引起的时变多普勒频移,生成非平稳风电场杂波数据。

使用方式:
配置风机位置、叶片长度、转速等参数,生成微多普勒时频分布,分析对检测性能的影响。

"""
Script 3: Wind Farm Micro-Doppler Clutter Modeling
Author: J Rosado-Sanz, MP Jarabo-Amores Implementation
Description: Time-varying wind turbine clutter for passive radar
"""

import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import stft

class WindTurbineClutter:
    """Micro-Doppler model for wind turbine scattering"""
    
    def __init__(self, position, blade_length, rotation_rpm, 
                 n_blades=3, tower_height=80):
        """
        Initialize wind turbine parameters
        
        Parameters:
        -----------
        position : ndarray (2,)
            [x, y] position in km relative to receiver
        blade_length : float
            Blade length in meters
        rotation_rpm : float
            Rotation speed in RPM
        n_blades : int
            Number of blades (typically 3)
        tower_height : float
            Tower height in meters
        """
        self.pos = np.array(position)
        self.L = blade_length
        self.rpm = rotation_rpm
        self.n_blades = n_blades
        self.h_tower = tower_height
        
        # Calculate angular velocity (rad/s)
        self.omega = 2 * np.pi * rotation_rpm / 60
        
        # RCS parameters (simplified)
        self.rcs_nacelle = 10  # m^2
        self.rcs_tower = 20    # m^2
        self.rcs_blade = 5     # m^2 per blade tip
        
    def micro_doppler_signature(self, t, wavelength, tx_pos, rx_pos):
        """
        Calculate instantaneous micro-Doppler frequencies
        
        Parameters:
        -----------
        t : ndarray
            Time vector
        wavelength : float
            Radar wavelength
        tx_pos, rx_pos : ndarray
            Transmitter and receiver positions
            
        Returns:
        --------
        fd_t : ndarray
            Instantaneous Doppler frequencies over time
        amplitude : ndarray
            Instantaneous amplitude modulation
        """
        # Vector from turbine to Tx and Rx
        vec_tx = tx_pos - self.pos
        vec_rx = rx_pos - self.pos
        
        # Bistatic angle components
        u_tx = vec_tx / np.linalg.norm(vec_tx)
        u_rx = vec_rx / np.linalg.norm(vec_rx)
        
        # Effective rotation vector (assuming horizontal rotation)
        # Simplified: blades rotate in plane perpendicular to line of sight
        fd_t = np.zeros(len(t))
        amplitude = np.zeros(len(t))
        
        # For each blade
        for b in range(self.n_blades):
            # Initial phase for this blade (120 degree separation)
            phi0 = b * 2 * np.pi / self.n_blades
            
            # Instantaneous blade tip position
            phi_t = phi0 + self.omega * t
            
            # Tip velocity vector (tangential)
            # Simplified 2D projection
            v_tip = self.L * self.omega * np.array([-np.sin(phi_t), np.cos(phi_t)])
            
            # Bistatic Doppler for this blade
            fd_blade = (1/wavelength) * (np.dot(v_tip, u_tx) + np.dot(v_tip, u_rx))
            
            # Amplitude modulation (strongest when tip moves toward/away from radar)
            # Modulated by projection of tip velocity onto bistatic bisector
            amp_blade = np.abs(np.cos(phi_t)) * self.rcs_blade
            
            fd_t += fd_blade
            amplitude += amp_blade
        
        # Add tower and nacelle contributions (zero Doppler, constant)
        amplitude += self.rcs_nacelle + self.rcs_tower
        
        return fd_t, amplitude
    
    def generate_signal(self, t, wavelength, tx_pos, rx_pos, noise_level=0.1):
        """
        Generate complex baseband signal from turbine
        
        Returns:
        --------
        signal : ndarray (complex)
            Time-domain complex signal
        """
        fd_t, amp_t = self.micro_doppler_signature(t, wavelength, tx_pos, rx_pos)
        
        # Instantaneous phase
        phase = 2 * np.pi * np.cumsum(fd_t) * (t[1] - t[0])
        
        # Complex signal with amplitude modulation
        signal = np.sqrt(amp_t) * np.exp(1j * phase)
        
        # Add noise
        signal += noise_level * (np.random.randn(len(t)) + 1j*np.random.randn(len(t)))
        
        return signal

class WindFarmEnvironment:
    """Multiple wind turbines environment"""
    
    def __init__(self, turbine_configs):
        """
        Initialize wind farm
        
        Parameters:
        -----------
        turbine_configs : list of dict
            Each dict contains position, blade_length, rpm for one turbine
        """
        self.turbines = []
        for config in turbine_configs:
            self.turbines.append(WindTurbineClutter(**config))
    
    def generate_farm_clutter(self, t, wavelength, tx_pos, rx_pos):
        """
        Generate combined clutter from all turbines
        """
        total_signal = np.zeros(len(t), dtype=complex)
        
        for turbine in self.turbines:
            signal = turbine.generate_signal(t, wavelength, tx_pos, rx_pos)
            total_signal += signal
        
        return total_signal

def demo_wind_turbine():
    """Demonstrate single wind turbine micro-Doppler"""
    print("=" * 60)
    print("Wind Turbine Micro-Doppler Modeling")
    print("=" * 60)
    
    # Single turbine scenario
    tx_pos = np.array([0, 0])      # Transmitter at origin
    rx_pos = np.array([10, 0])     # Receiver 10km east
    turbine_pos = np.array([5, 3]) # Turbine between Tx and Rx
    
    wavelength = 3.0  # 100 MHz FM signal
    
    turbine = WindTurbineClutter(
        position=turbine_pos,
        blade_length=40,      # 40m blades
        rotation_rpm=20,      # 20 RPM
        n_blades=3,
        tower_height=80
    )
    
    # Time vector (2 seconds)
    fs = 1000  # Sampling rate Hz
    t = np.arange(0, 2, 1/fs)
    
    # Generate signal
    signal = turbine.generate_signal(t, wavelength, tx_pos, rx_pos)
    
    # Time-frequency analysis
    f, t_stft, Zxx = stft(signal, fs, nperseg=256, noverlap=200)
    
    print(f"Generated {len(t)} samples of wind turbine clutter")
    print(f"Rotation period: {60/turbine.rpm:.2f} seconds")
    print(f"Max blade tip speed: {turbine.L * turbine.omega:.1f} m/s")
    print(f"Expected max Doppler: {2*turbine.L*turbine.omega/wavelength:.1f} Hz")
    
    # Visualization
    fig, axes = plt.subplots(2, 2, figsize=(14, 10))
    
    # 1. Time domain amplitude
    ax1 = axes[0, 0]
    ax1.plot(t, np.abs(signal), linewidth=1)
    ax1.set_xlabel('Time (s)')
    ax1.set_ylabel('Amplitude')
    ax1.set_title('Time Domain Signal (Turbine)')
    ax1.grid(True, alpha=0.3)
    
    # 2. Spectrogram
    ax2 = axes[0, 1]
    im = ax2.pcolormesh(t_stft, f, 20*np.log10(np.abs(Zxx) + 1e-10), 
                       cmap='jet', shading='gouraud')
    ax2.set_ylabel('Frequency (Hz)')
    ax2.set_xlabel('Time (s)')
    ax2.set_title('Micro-Doppler Spectrogram')
    ax2.set_ylim(-50, 50)
    plt.colorbar(im, ax=ax2, label='Power (dB)')
    
    # 3. Instantaneous frequency
    ax3 = axes[1, 0]
    fd_t, _ = turbine.micro_doppler_signature(t, wavelength, tx_pos, rx_pos)
    ax3.plot(t, fd_t, linewidth=2, color='red')
    ax3.set_xlabel('Time (s)')
    ax3.set_ylabel('Doppler Frequency (Hz)')
    ax3.set_title('Instantaneous Doppler Shift')
    ax3.grid(True, alpha=0.3)
    
    # 4. Amplitude modulation
    ax4 = axes[1, 1]
    _, amp_t = turbine.micro_doppler_signature(t, wavelength, tx_pos, rx_pos)
    ax4.plot(t, amp_t, linewidth=2, color='blue')
    ax4.set_xlabel('Time (s)')
    ax4.set_ylabel('RCS Modulation')
    ax4.set_title('Amplitude Modulation by Rotation')
    ax4.grid(True, alpha=0.3)
    
    plt.suptitle('Wind Turbine Micro-Doppler Characteristics', fontsize=14)
    plt.tight_layout()
    plt.savefig('wind_turbine_microdoppler.png', dpi=150, bbox_inches='tight')
    plt.show()

def demo_wind_farm():
    """Demonstrate multiple turbine scenario"""
    print("\nGenerating multi-turbine wind farm scenario...")
    
    # Wind farm layout: 3 turbines
    farm_config = [
        {'position': [4, 2], 'blade_length': 45, 'rotation_rpm': 15},
        {'position': [5, 0], 'blade_length': 40, 'rotation_rpm': 18},
        {'position': [6, -2], 'blade_length': 50, 'rotation_rpm': 12}
    ]
    
    farm = WindFarmEnvironment(farm_config)
    
    tx_pos = np.array([0, 0])
    rx_pos = np.array([10, 0])
    wavelength = 3.0
    
    fs = 1000
    t = np.arange(0, 3, 1/fs)
    
    signal = farm.generate_farm_clutter(t, wavelength, tx_pos, rx_pos)
    
    # Spectrogram
    f, t_stft, Zxx = stft(signal, fs, nperseg=512, noverlap=400)
    
    plt.figure(figsize=(12, 6))
    plt.pcolormesh(t_stft, f, 20*np.log10(np.abs(Zxx) + 1e-10), 
                   cmap='jet', shading='gouraud')
    plt.ylabel('Frequency (Hz)')
    plt.xlabel('Time (s)')
    plt.title('Wind Farm Clutter: Multiple Turbine Micro-Doppler Signatures')
    plt.colorbar(label='Power (dB)')
    plt.ylim(-60, 60)
    plt.tight_layout()
    plt.savefig('wind_farm_clutter.png', dpi=150, bbox_inches='tight')
    plt.show()

if __name__ == "__main__":
    demo_wind_turbine()
    demo_wind_farm()
    print("\nVisualization files generated:")
    print("- wind_turbine_microdoppler.png")
    print("- wind_farm_clutter.png")

脚本4: MVDR与LCMV自适应波束成形

脚本功能:
实现MVDR(最小方差无失真响应)与LCMV(线性约束最小方差)自适应波束成形算法,用于抑制海杂波与风电场杂波。

使用方式:
输入阵列接收数据、导向矢量与约束条件,计算最优权重,输出生成方向图与SINR性能。

"""
Script 4: MVDR and LCMV Adaptive Beamforming
Author: J Rosado-Sanz, MP Jarabo-Amores Implementation
Description: Adaptive beamforming for sea and wind farm clutter suppression
"""

import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import inv

class AdaptiveBeamformer:
    """MVDR and LCMV beamformers for passive radar"""
    
    def __init__(self, n_elements, element_spacing=0.5):
        self.N = n_elements
        self.d = element_spacing
        self.weights = None
        
    def steering_vector(self, angle_deg, wavelength=1.0):
        """
        Compute steering vector for given angle
        
        Parameters:
        -----------
        angle_deg : float
            Angle in degrees
        wavelength : float
            Signal wavelength
            
        Returns:
        --------
        a : ndarray (N,)
            Steering vector
        """
        angle_rad = np.deg2rad(angle_deg)
        k = 2 * np.pi / wavelength
        positions = np.arange(self.N) * self.d * wavelength
        
        a = np.exp(1j * k * positions * np.sin(angle_rad))
        return a.reshape(-1, 1)
    
    def sample_covariance(self, snapshots, diagonal_loading=None):
        """
        Estimate sample covariance matrix
        
        Parameters:
        -----------
        snapshots : ndarray (N, K)
            Array data matrix (N elements, K samples)
        diagonal_loading : float or None
            Loading level for regularization
            
        Returns:
        --------
        R : ndarray (N, N)
            Covariance matrix
        """
        K = snapshots.shape[1]
        R = snapshots @ snapshots.conj().T / K
        
        if diagonal_loading is not None:
            R += diagonal_loading * np.eye(self.N)
            
        return R
    
    def mvdr_beamformer(self, R, target_angle, wavelength=1.0):
        """
        MVDR beamformer: minimize power subject to distortionless constraint
        
        Parameters:
        -----------
        R : ndarray (N, N)
            Covariance matrix
        target_angle : float
            Target direction in degrees
            
        Returns:
        --------
        w : ndarray (N,)
            Beamformer weights
        """
        a = self.steering_vector(target_angle, wavelength)
        
        # MVDR solution: w = R^-1 a / (a^H R^-1 a)
        R_inv = inv(R)
        w = R_inv @ a
        w = w / (a.conj().T @ w)
        
        self.weights = w.flatten()
        return self.weights
    
    def lcmv_beamformer(self, R, constraint_matrix, constraint_response):
        """
        LCMV beamformer with multiple linear constraints
        
        Parameters:
        -----------
        R : ndarray (N, N)
            Covariance matrix
        constraint_matrix : ndarray (N, M)
            Constraint matrix C (each column is a constraint vector)
        constraint_response : ndarray (M,)
            Desired response f for each constraint
            
        Returns:
        --------
        w : ndarray (N,)
            Beamformer weights
        """
        C = constraint_matrix
        f = constraint_response.reshape(-1, 1)
        
        # LCMV solution: w = R^-1 C (C^H R^-1 C)^-1 f
        R_inv = inv(R)
        w = R_inv @ C @ inv(C.conj().T @ R_inv @ C) @ f
        
        self.weights = w.flatten()
        return self.weights
    
    def array_pattern(self, angles, wavelength=1.0):
        """
        Compute beam pattern for given angles
        
        Returns:
        --------
        pattern : ndarray
            Power pattern in dB
        """
        if self.weights is None:
            raise ValueError("Weights not computed. Run beamformer first.")
        
        pattern = np.zeros(len(angles))
        for i, ang in enumerate(angles):
            a = self.steering_vector(ang, wavelength).flatten()
            pattern[i] = np.abs(np.conj(self.weights) @ a)**2
        
        pattern_db = 10 * np.log10(pattern / np.max(pattern) + 1e-10)
        return pattern_db
    
    def output_sinr(self, R_signal, R_interference):
        """
        Calculate output SINR
        
        Parameters:
        -----------
        R_signal : ndarray (N, N)
            Signal covariance
        R_interference : ndarray (N, N)
            Interference + noise covariance
            
        Returns:
        --------
        sinr : float
            Output SINR (linear)
        """
        if self.weights is None:
            raise ValueError("Weights not computed.")
        
        w = self.weights.reshape(-1, 1)
        
        P_signal = np.real(w.conj().T @ R_signal @ w)
        P_int = np.real(w.conj().T @ R_interference @ w)
        
        return P_signal / P_int

def demo_mvdr_vs_lcmv():
    """Compare MVDR and LCMV for clutter suppression"""
    print("=" * 60)
    print("MVDR vs LCMV Beamforming for Clutter Suppression")
    print("=" * 60)
    
    # Setup
    N = 8
    bf = AdaptiveBeamformer(N)
    
    # Generate scenario: target at 0°, sea clutter at -30° to -10°, 
    # wind farm at 40°
    target_angle = 0
    clutter_angles = [-30, -20, -10]
    wind_farm_angle = 40
    
    wavelength = 1.0
    
    # Generate data snapshots
    n_samples = 500
    
    # Target signal
    a_target = bf.steering_vector(target_angle, wavelength).flatten()
    signal = np.outer(a_target, np.random.randn(n_samples) + 1j*np.random.randn(n_samples))
    
    # Sea clutter (correlated)
    clutter = np.zeros((N, n_samples), dtype=complex)
    for c_angle in clutter_angles:
        a_clutter = bf.steering_vector(c_angle, wavelength).flatten()
        clutter += np.outer(a_clutter, 
                           (np.random.randn(n_samples) + 1j*np.random.randn(n_samples))/np.sqrt(2))
    
    # Wind farm clutter
    a_wind = bf.steering_vector(wind_farm_angle, wavelength).flatten()
    wind_clutter = np.outer(a_wind, 
                           2*(np.random.randn(n_samples) + 1j*np.random.randn(n_samples))/np.sqrt(2))
    
    # Noise
    noise = (np.random.randn(N, n_samples) + 1j*np.random.randn(N, n_samples)) / np.sqrt(2)
    
    # Total received signal
    snapshots = signal + clutter + wind_clutter + noise
    
    # Covariance matrix
    R = bf.sample_covariance(snapshots, diagonal_loading=0.01)
    
    # MVDR beamformer
    w_mvdr = bf.mvdr_beamformer(R, target_angle, wavelength)
    pattern_mvdr = bf.array_pattern(np.linspace(-90, 90, 361), wavelength)
    
    # LCMV beamformer: constrain target, null clutter and wind farm
    C = np.column_stack([
        bf.steering_vector(target_angle, wavelength),
        bf.steering_vector(-20, wavelength),  # Deep null in clutter region
        bf.steering_vector(wind_farm_angle, wavelength)  # Null wind farm
    ])
    f = np.array([1, 0, 0])  # Pass target, reject others
    
    w_lcmv = bf.lcmv_beamformer(R, C, f)
    pattern_lcmv = bf.array_pattern(np.linspace(-90, 90, 361), wavelength)
    
    # Evaluate SINR
    R_sig = np.outer(a_target, a_target.conj())
    R_int = np.eye(N)  # Simplified interference
    
    sinr_mvdr = bf.output_sinr(R_sig, R_int)
    sinr_lcmv = bf.output_sinr(R_sig, R_int)
    
    print(f"MVDR Output SINR: {10*np.log10(sinr_mvdr):.2f} dB")
    print(f"LCMV Output SINR: {10*np.log10(sinr_lcmv):.2f} dB")
    
    # Visualization
    fig, axes = plt.subplots(1, 2, figsize=(14, 6), 
                            subplot_kw=dict(projection='polar'))
    
    angles = np.linspace(-90, 90, 361)
    angles_rad = np.deg2rad(angles)
    
    # MVDR plot
    ax1 = axes[0]
    ax1.plot(angles_rad, pattern_mvdr, linewidth=2, label='MVDR')
    ax1.axvline(np.deg2rad(target_angle), color='green', linestyle='--', 
               label='Target')
    for ca in clutter_angles:
        ax1.axvline(np.deg2rad(ca), color='blue', linestyle=':', alpha=0.5)
    ax1.axvline(np.deg2rad(wind_farm_angle), color='red', linestyle=':', alpha=0.5)
    ax1.set_ylim(-40, 5)
    ax1.set_title('MVDR Beam Pattern', pad=20)
    ax1.legend(loc='upper right', bbox_to_anchor=(1.3, 1.1))
    
    # LCMV plot
    ax2 = axes[1]
    ax2.plot(angles_rad, pattern_lcmv, linewidth=2, color='orange', label='LCMV')
    ax2.axvline(np.deg2rad(target_angle), color='green', linestyle='--')
    for ca in clutter_angles:
        ax2.axvline(np.deg2rad(ca), color='blue', linestyle=':', alpha=0.5)
    ax2.axvline(np.deg2rad(wind_farm_angle), color='red', linestyle=':', alpha=0.5)
    ax2.set_ylim(-40, 5)
    ax2.set_title('LCMV Beam Pattern (Constrained Nulls)', pad=20)
    ax2.legend(loc='upper right', bbox_to_anchor=(1.3, 1.1))
    
    plt.suptitle('Adaptive Beamforming: Sea Clutter and Wind Farm Suppression', 
                fontsize=14)
    plt.tight_layout()
    plt.savefig('mvdr_lcmv_comparison.png', dpi=150, bbox_inches='tight')
    plt.show()

if __name__ == "__main__":
    demo_mvdr_vs_lcmv()
    print("\nVisualization file generated:")
    print("- mvdr_lcmv_comparison.png")

脚本5: 空时自适应处理(STAP)实现

脚本功能:
实现空时自适应处理(STAP)算法,联合利用空域与多普勒域自由度抑制杂波。包含降维处理与对角加载技术。

使用方式:
输入空时数据立方体,估计空时协方差矩阵,计算STAP权重,输出生成空时方向图与改善因子。

"""
Script 5: Space-Time Adaptive Processing (STAP) Implementation
Author: J Rosado-Sanz, MP Jarabo-Amores Implementation
Description: STAP for sea and wind farm clutter suppression in passive radar
"""

import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import inv, eigh

class STAPProcessor:
    """Space-Time Adaptive Processing for passive radar clutter suppression"""
    
    def __init__(self, n_elements, n_pulses, element_spacing=0.5):
        self.N = n_elements  # Spatial DOF
        self.M = n_pulses    # Temporal DOF
        self.NM = n_elements * n_pulses
        self.d = element_spacing
        
    def space_time_steering(self, angle_deg, doppler_freq, prf=1.0):
        """
        Construct space-time steering vector
        
        Parameters:
        -----------
        angle_deg : float
            Spatial angle
        doppler_freq : float
            Normalized Doppler frequency (-0.5 to 0.5)
        prf : float
            Pulse repetition frequency
            
        Returns:
        --------
        v : ndarray (NM, 1)
            Space-time steering vector
        """
        angle_rad = np.deg2rad(angle_deg)
        
        # Spatial steering
        k = 2 * np.pi
        pos = np.arange(self.N) * self.d
        a = np.exp(1j * k * pos * np.sin(angle_rad))
        
        # Temporal steering
        time_vec = np.arange(self.M) / prf
        b = np.exp(1j * 2 * np.pi * doppler_freq * time_vec)
        
        # Kronecker product
        v = np.kron(b, a).reshape(-1, 1)
        return v
    
    def estimate_covariance(self, data_cube, diagonal_loading=None):
        """
        Estimate space-time covariance matrix from training data
        
        Parameters:
        -----------
        data_cube : ndarray (N, M, K)
            Training data (N elements, M pulses, K range bins)
        diagonal_loading : float
            Loading level
            
        Returns:
        --------
        R : ndarray (NM, NM)
            Covariance matrix
        """
        N, M, K = data_cube.shape
        
        # Reshape to space-time snapshots
        X = np.zeros((self.NM, K), dtype=complex)
        for k in range(K):
            X[:, k] = data_cube[:, :, k].flatten('F')
        
        # Sample covariance
        R = X @ X.conj().T / K
        
        if diagonal_loading is not None:
            R += diagonal_loading * np.trace(R) / self.NM * np.eye(self.NM)
            
        return R
    
    def full_stap(self, R, target_angle, target_doppler, prf=1.0):
        """
        Full-dimension STAP filter
        
        Parameters:
        -----------
        R : ndarray (NM, NM)
            Covariance matrix
        target_angle : float
            Target angle in degrees
        target_doppler : float
            Target Doppler frequency
            
        Returns:
        --------
        w : ndarray (NM,)
            STAP weights
        """
        v = self.space_time_steering(target_angle, target_doppler, prf)
        
        # MVDR-STAP
        R_inv = inv(R)
        w = R_inv @ v
        w = w / (v.conj().T @ w)
        
        return w.flatten()
    
    def reduced_rank_stap(self, R, target_angle, target_doppler, 
                         rank=None, method='pca'):
        """
        Reduced-rank STAP for computational efficiency
        
        Parameters:
        -----------
        R : ndarray (NM, NM)
            Covariance matrix
        target_angle, target_doppler : float
        rank : int
            Reduced rank
        method : str
            'pca' or 'jdl' (Joint Domain Localization)
            
        Returns:
        --------
        w : ndarray (NM,)
            Reduced-rank weights
        """
        if method == 'pca':
            # Eigendecomposition and rank reduction
            eigenvalues, eigenvectors = eigh(R)
            
            if rank is None:
                # Automatic rank selection based on eigenvalue threshold
                threshold = 0.01 * np.max(eigenvalues)
                rank = np.sum(eigenvalues > threshold)
                rank = max(3, min(rank, self.NM//4))
            
            # Select dominant eigenvectors
            idx = np.argsort(eigenvalues)[::-1]
            U = eigenvectors[:, idx[:rank]]
            
            # Project to lower dimension
            v = self.space_time_steering(target_angle, target_doppler)
            v_proj = U.conj().T @ v
            R_proj = U.conj().T @ R @ U
            
            # Compute weights in reduced space
            w_proj = inv(R_proj) @ v_proj
            w_proj = w_proj / (v_proj.conj().T @ w_proj)
            
            # Transform back
            w = U @ w_proj
            
        elif method == 'jdl':
            # Joint Domain Localization
            # Select local angle-Doppler bins
            # Simplified implementation
            w = self.full_stap(R, target_angle, target_doppler)
            
        return w.flatten()
    
    def stap_filter(self, data_cube, weights):
        """
        Apply STAP filter to data cube
        
        Parameters:
        -----------
        data_cube : ndarray (N, M, L)
            Data to filter (L range bins)
        weights : ndarray (NM,)
            STAP weights
            
        Returns:
        --------
        output : ndarray (L,)
            Filtered output power
        """
        N, M, L = data_cube.shape
        output = np.zeros(L, dtype=complex)
        
        for l in range(L):
            x = data_cube[:, :, l].flatten('F')
            output[l] = np.conj(weights) @ x
        
        return output

def demo_stap_clutter():
    """Demonstrate STAP for sea clutter suppression"""
    print("=" * 60)
    print("Space-Time Adaptive Processing (STAP) Demonstration")
    print("=" * 60)
    
    # Setup: 8 elements, 16 pulses
    N, M = 8, 16
    stap = STAPProcessor(N, M)
    
    # Generate training data: clutter + noise
    n_range_bins = 100
    
    # Simulate angle-Doppler clutter ridge (sea clutter disperses in both domains)
    data_cube = np.zeros((N, M, n_range_bins), dtype=complex)
    
    # Clutter parameters
    clutter_angles = np.linspace(-60, 60, 20)  # Distributed clutter
    clutter_dopplers = 0.1 * np.sin(np.deg2rad(clutter_angles))  # Doppler depends on angle
    
    for r in range(n_range_bins):
        snapshot = np.zeros((N, M), dtype=complex)
        
        # Add distributed clutter
        for ca, cd in zip(clutter_angles, clutter_dopplers):
            v = stap.space_time_steering(ca, cd).reshape(N, M)
            amplitude = (np.random.randn() + 1j*np.random.randn()) / np.sqrt(2)
            snapshot += amplitude * v * 10  # Strong clutter
        
        # Add noise
        snapshot += (np.random.randn(N, M) + 1j*np.random.randn(N, M)) / np.sqrt(2)
        
        data_cube[:, :, r] = snapshot
    
    # Target signal (at 0°, 0.2 Doppler)
    target_range = 50
    v_target = stap.space_time_steering(0, 0.2).reshape(N, M)
    data_cube[:, :, target_range] += v_target * 5  # Insert target
    
    # Estimate covariance (exclude target range and guard cells)
    train_indices = list(range(0, target_range-2)) + list(range(target_range+3, n_range_bins))
    train_data = data_cube[:, :, train_indices]
    
    R = stap.estimate_covariance(train_data, diagonal_loading=0.001)
    
    # Compute STAP weights
    w_full = stap.full_stap(R, 0, 0.2)
    w_reduced = stap.reduced_rank_stap(R, 0, 0.2, rank=12, method='pca')
    
    # Apply filtering
    output_full = np.abs(stap.stap_filter(data_cube, w_full))**2
    output_reduced = np.abs(stap.stap_filter(data_cube, w_reduced))**2
    
    # Normalize
    output_full = output_full / np.mean(output_full)
    output_reduced = output_reduced / np.mean(output_reduced)
    
    print(f"Full-dimension STAP: Target peak at range {target_range}")
    print(f"Peak-to-clutter ratio (Full): {10*np.log10(output_full[target_range]/np.mean(output_full[:target_range-2])):.2f} dB")
    print(f"Peak-to-clutter ratio (Reduced): {10*np.log10(output_reduced[target_range]/np.mean(output_reduced[:target_range-2])):.2f} dB")
    
    # Visualization
    fig, axes = plt.subplots(1, 3, figsize=(18, 5))
    
    # Range profile comparison
    ax1 = axes[0]
    ax1.plot(10*np.log10(output_full), linewidth=2, label='Full STAP')
    ax1.plot(10*np.log10(output_reduced), linewidth=2, label='Reduced Rank', linestyle='--')
    ax1.axvline(target_range, color='red', linestyle=':', label='Target')
    ax1.set_xlabel('Range Bin')
    ax1.set_ylabel('Power (dB)')
    ax1.set_title('STAP Filtered Range Profile')
    ax1.legend()
    ax1.grid(True, alpha=0.3)
    
    # Angle-Doppler pattern (Full STAP)
    ax2 = axes[1]
    angles = np.linspace(-90, 90, 60)
    dopplers = np.linspace(-0.5, 0.5, 60)
    A, D = np.meshgrid(angles, dopplers)
    
    pattern = np.zeros((60, 60))
    for i, d in enumerate(dopplers):
        for j, a in enumerate(angles):
            v = stap.space_time_steering(a, d).flatten()
            pattern[i, j] = np.abs(np.conj(w_full) @ v)**2
    
    im = ax2.pcolormesh(angles, dopplers, 10*np.log10(pattern + 1e-10), 
                       cmap='jet', shading='auto')
    ax2.set_xlabel('Angle (degrees)')
    ax2.set_ylabel('Normalized Doppler')
    ax2.set_title('Full STAP Angle-Doppler Response')
    plt.colorbar(im, ax=ax2)
    
    # Reduced rank pattern
    ax3 = axes[2]
    pattern_red = np.zeros((60, 60))
    for i, d in enumerate(dopplers):
        for j, a in enumerate(angles):
            v = stap.space_time_steering(a, d).flatten()
            pattern_red[i, j] = np.abs(np.conj(w_reduced) @ v)**2
    
    im = ax3.pcolormesh(angles, dopplers, 10*np.log10(pattern_red + 1e-10), 
                       cmap='jet', shading='auto')
    ax3.set_xlabel('Angle (degrees)')
    ax3.set_ylabel('Normalized Doppler')
    ax3.set_title('Reduced-Rank STAP Response')
    plt.colorbar(im, ax=ax3)
    
    plt.tight_layout()
    plt.savefig('stap_clutter_suppression.png', dpi=150, bbox_inches='tight')
    plt.show()

if __name__ == "__main__":
    demo_stap_clutter()
    print("\nVisualization file generated:")
    print("- stap_clutter_suppression.png")

脚本6: 参考信号重建与杂波对消

脚本功能:
实现无源雷达参考信号提取、直达波抑制与杂波对消算法。包括自适应杂波对消(ACC)与扩展相消算法。

使用方式:
配置参考通道与监测通道数据,执行自适应对消滤除直达波与杂波,输出目标检测距离-多普勒图。

"""
Script 6: Reference Signal Reconstruction and Clutter Cancellation
Author: J Rosado-Sanz, MP Jarabo-Amores Implementation
Description: Reference signal extraction and adaptive clutter cancellation
"""

import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import correlate, hilbert

class PassiveRadarProcessor:
    """Passive radar signal processing chain"""
    
    def __init__(self, sample_rate, n_samples):
        self.fs = sample_rate
        self.n_samples = n_samples
        
    def reconstruct_reference(self, ref_channel, method='direct'):
        """
        Reconstruct clean reference signal from reference channel
        
        Parameters:
        -----------
        ref_channel : ndarray
            Reference antenna received signal
        method : str
            'direct', 'beamforming', or 'eigen_cleaning'
            
        Returns:
        --------
        ref_clean : ndarray
            Clean reference signal
        """
        if method == 'direct':
            # Simple bandpass or direct use (assuming high SNR)
            ref_clean = ref_channel
            
        elif method == 'eigen_cleaning':
            # Remove interference via eigendecomposition (simplified)
            # Assume ref_channel is already the dominant component
            ref_clean = ref_channel
            
        return ref_clean
    
    def adaptive_clutter_cancellation(self, surv_channel, ref_signal, 
                                     filter_order=50, adaptation_rate=0.01):
        """
        Adaptive clutter cancellation using NLMS algorithm
        
        Parameters:
        -----------
        surv_channel : ndarray
            Surveillance antenna signal (clutter + target)
        ref_signal : ndarray
            Clean reference signal
        filter_order : int
            Length of adaptive filter
        adaptation_rate : float
            Step size for NLMS
            
        Returns:
        --------
        cancelled : ndarray
            Signal after clutter cancellation
        weights_history : ndarray
            Filter weight evolution
        """
        n = len(surv_channel)
        w = np.zeros(filter_order, dtype=complex)
        cancelled = np.zeros(n, dtype=complex)
        weights_history = np.zeros((n, filter_order), dtype=complex)
        
        # Normalized LMS adaptive filter
        for i in range(filter_order, n):
            x = ref_signal[i-filter_order:i][::-1]  # Reference vector
            
            # Filter output (predicted clutter)
            y = np.dot(w, x)
            
            # Error signal (target residual)
            e = surv_channel[i] - y
            cancelled[i] = e
            
            # NLMS update
            mu = adaptation_rate / (np.dot(x.conj(), x) + 1e-10)
            w = w + mu * e * x.conj()
            
            weights_history[i] = w
        
        return cancelled, weights_history
    
    def extended_cancellation(self, surv_channel, ref_signal, 
                             n_stages=3, filter_order=50):
        """
        Multi-stage extended cancellation algorithm
        
        Parameters:
        -----------
        n_stages : int
            Number of cancellation stages
            
        Returns:
        --------
        residual : ndarray
            Final residual after multiple stages
        """
        residual = surv_channel.copy()
        
        for stage in range(n_stages):
            # Each stage cancels remaining correlated components
            ref_stage = ref_signal if stage == 0 else ref_signal  # Could be modified
            
            residual, _ = self.adaptive_clutter_cancellation(
                residual, ref_stage, filter_order, 
                adaptation_rate=0.01/(stage+1)
            )
        
        return residual
    
    def cross_correlation_detector(self, surv_signal, ref_signal, 
                                  max_delay=1000):
        """
        Cross-correlation based range-Doppler processing
        
        Parameters:
        -----------
        surv_signal : ndarray
            Surveillance signal after cancellation
        ref_signal : ndarray
            Reference signal
        max_delay : int
            Maximum range delay in samples
            
        Returns:
        --------
        rd_map : ndarray (max_delay, doppler_bins)
            Range-Doppler map
        """
        # Simplified range-Doppler processing
        # In practice, use FFT-based fast correlation
        
        doppler_bins = 64
        rd_map = np.zeros((max_delay, doppler_bins), dtype=complex)
        
        # Apply Doppler shifts to reference
        for d_idx in range(doppler_bins):
            fd = (d_idx - doppler_bins/2) / doppler_bins * self.fs / 2
            
            # Doppler shifted reference
            t = np.arange(len(ref_signal)) / self.fs
            ref_shifted = ref_signal * np.exp(-1j * 2 * np.pi * fd * t)
            
            # Cross-correlation for range
            for r_idx in range(max_delay):
                if r_idx < len(surv_signal):
                    # Simple correlation at delay r_idx
                    corr = np.sum(surv_signal[r_idx:] * ref_shifted[:-r_idx].conj())
                    rd_map[r_idx, d_idx] = corr
        
        return rd_map

def demo_passive_radar_chain():
    """Demonstrate complete passive radar processing chain"""
    print("=" * 60)
    print("Passive Radar: Reference Reconstruction and Clutter Cancellation")
    print("=" * 60)
    
    # Setup
    fs = 1e6  # 1 MHz sampling
    T = 0.01  # 10 ms integration
    n_samples = int(fs * T)
    
    processor = PassiveRadarProcessor(fs, n_samples)
    
    # Generate simulated signals
    t = np.arange(n_samples) / fs
    
    # Reference signal (DVB-T like OFDM, simplified as noise)
    ref_clean = (np.random.randn(n_samples) + 1j*np.random.randn(n_samples))
    ref_clean = ref_clean / np.std(ref_clean)
    
    # Surveillance channel: delayed target + clutter + noise
    delay_target = 500  # samples (represents range)
    doppler_target = 1000  # Hz
    
    # Target (weak)
    target_sig = 0.01 * ref_clean * np.exp(1j * 2 * np.pi * doppler_target * t)
    target_sig = np.roll(target_sig, delay_target)
    
    # Sea clutter (strong, zero Doppler for simplicity)
    clutter = 0.5 * (np.random.randn(n_samples) + 1j*np.random.randn(n_samples))
    clutter = np.convolve(clutter, np.ones(10)/10, mode='same')  # Correlate with ref
    
    # Surveillance signal
    surv = target_sig + clutter + 0.1*(np.random.randn(n_samples) + 
                                        1j*np.random.randn(n_samples))
    
    # Reference channel (cleaner)
    ref_channel = ref_clean + 0.01*(np.random.randn(n_samples) + 
                                     1j*np.random.randn(n_samples))
    
    print("Signal components generated:")
    print(f"  Target delay: {delay_target} samples, Doppler: {doppler_target} Hz")
    print(f"  Clutter level: 30 dB above target")
    
    # Processing
    print("\nExecuting adaptive clutter cancellation...")
    
    # Single stage
    cancelled_1stage, _ = processor.adaptive_clutter_cancellation(
        surv, ref_channel, filter_order=100, adaptation_rate=0.02
    )
    
    # Extended cancellation (3 stages)
    cancelled_3stage = processor.extended_cancellation(
        surv, ref_channel, n_stages=3, filter_order=100
    )
    
    # Range-Doppler processing
    rd_original = processor.cross_correlation_detector(surv, ref_channel, max_delay=1000)
    rd_cancelled = processor.cross_correlation_detector(cancelled_3stage, ref_channel, max_delay=1000)
    
    # Visualization
    fig, axes = plt.subplots(2, 2, figsize=(14, 10))
    
    # Time domain
    ax1 = axes[0, 0]
    ax1.plot(20*np.log10(np.abs(surv) + 1e-10), label='Raw Surveillance', alpha=0.7)
    ax1.plot(20*np.log10(np.abs(cancelled_3stage) + 1e-10), label='After Cancellation', linewidth=2)
    ax1.axvline(delay_target, color='red', linestyle='--', label='Target delay')
    ax1.set_xlabel('Sample')
    ax1.set_ylabel('Amplitude (dB)')
    ax1.set_title('Time Domain: Clutter Cancellation Effect')
    ax1.legend()
    ax1.grid(True, alpha=0.3)
    
    # Range profiles
    ax2 = axes[0, 1]
    range_profile_orig = np.max(np.abs(rd_original), axis=1)
    range_profile_canc = np.max(np.abs(rd_cancelled), axis=1)
    
    ax2.plot(20*np.log10(range_profile_orig + 1e-10), label='Raw', alpha=0.7)
    ax2.plot(20*np.log10(range_profile_canc + 1e-10), label='Clutter Cancelled', linewidth=2)
    ax2.axvline(delay_target, color='red', linestyle='--', label='Target')
    ax2.set_xlabel('Range (samples)')
    ax2.set_ylabel('Correlation (dB)')
    ax2.set_title('Range Profile Comparison')
    ax2.legend()
    ax2.grid(True, alpha=0.3)
    
    # Range-Doppler map (raw)
    ax3 = axes[1, 0]
    im = ax3.imshow(20*np.log10(np.abs(rd_original) + 1e-10), 
                   aspect='auto', cmap='jet', origin='lower')
    ax3.set_title('Range-Doppler Map (Raw)')
    ax3.set_xlabel('Doppler Bin')
    ax3.set_ylabel('Range (samples)')
    plt.colorbar(im, ax=ax3)
    
    # Range-Doppler map (cancelled)
    ax4 = axes[1, 1]
    im = ax4.imshow(20*np.log10(np.abs(rd_cancelled) + 1e-10), 
                   aspect='auto', cmap='jet', origin='lower')
    ax4.set_title('Range-Doppler Map (Clutter Cancelled)')
    ax4.set_xlabel('Doppler Bin')
    ax4.set_ylabel('Range (samples)')
    plt.colorbar(im, ax=ax4)
    
    plt.suptitle('Passive Radar Signal Processing: Clutter Cancellation Results', 
                fontsize=14)
    plt.tight_layout()
    plt.savefig('passive_radar_cancellation.png', dpi=150, bbox_inches='tight')
    plt.show()
    
    # Metrics
    improvement = 20*np.log10(range_profile_canc[delay_target]/range_profile_orig[delay_target])
    print(f"\nProcessing results:")
    print(f"  Target peak improvement: {improvement:.2f} dB")
    print(f"  Clutter suppression: {20*np.log10(np.mean(range_profile_orig)/np.mean(range_profile_canc)):.2f} dB")

if __name__ == "__main__":
    demo_passive_radar_chain()
    print("\nVisualization file generated:")
    print("- passive_radar_cancellation.png")

脚本7: 检测性能评估与ROC分析

脚本功能:
评估自适应处理后的检测性能,生成ROC曲线(接收机工作特性),对比不同算法在不同杂波环境下的检测概率与虚警概率。

使用方式:
运行蒙特卡洛仿真,统计检测性能,绘制ROC曲线与检测性能随SCR(信杂比)变化曲线。

"""
Script 7: Detection Performance Evaluation and ROC Analysis
Author: J Rosado-Sanz, MP Jarabo-Amores Implementation
Description: ROC curves and detection performance for passive radar
"""

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy import integrate

class DetectionAnalyzer:
    """Detection performance analysis for passive radar systems"""
    
    def __init__(self, n_trials=1000):
        self.n_trials = n_trials
        self.results = {}
        
    def generate_test_data(self, scr_db, clutter_type='sea', 
                          n_samples=1000, array_size=8):
        """
        Generate test data with specified Signal-to-Clutter Ratio
        
        Parameters:
        -----------
        scr_db : float
            Signal-to-Clutter Ratio in dB
        clutter_type : str
            'sea', 'wind', or 'mixed'
        n_samples : int
            Number of samples per trial
        array_size : int
            Number of array elements
            
        Returns:
        --------
        data_h0 : ndarray
            Clutter-only data (null hypothesis)
        data_h1 : ndarray
            Clutter + target data (alternative hypothesis)
        """
        # Clutter generation (simplified)
        if clutter_type == 'sea':
            # K-distributed-like (heavy tail)
            shape = 1.0
            texture = np.random.gamma(shape, 1/shape, (array_size, n_samples))
            speckle = (np.random.randn(array_size, n_samples) + 
                      1j*np.random.randn(array_size, n_samples)) / np.sqrt(2)
            clutter = np.sqrt(texture) * speckle
        else:
            # Gaussian for comparison
            clutter = (np.random.randn(array_size, n_samples) + 
                      1j*np.random.randn(array_size, n_samples)) / np.sqrt(2)
        
        # Normalization
        clutter = clutter / np.std(clutter)
        
        # Target signal
        steering = np.exp(1j * np.arange(array_size) * np.pi * 0.5)
        steering = steering / np.linalg.norm(steering)
        
        target_amp = 10**(scr_db/20)
        target_base = (np.random.randn(n_samples) + 1j*np.random.randn(n_samples))
        target = target_amp * np.outer(steering, target_base)
        
        data_h0 = clutter
        data_h1 = clutter + target
        
        return data_h0, data_h1
    
    def adaptive_processing(self, data, method='mvdr'):
        """
        Apply adaptive processing to data
        
        Returns:
        --------
        test_statistic : ndarray
            Detection statistic (output power)
        """
        # Simplified beamforming
        # In practice, use full STAP as implemented in previous scripts
        
        # Sample covariance
        R = data @ data.conj().T / data.shape[1] + 0.1*np.eye(data.shape[0])
        
        # Steering vector (assumed known)
        a = np.exp(1j * np.arange(data.shape[0]) * np.pi * 0.5)
        a = a.reshape(-1, 1)
        
        # MVDR weights
        R_inv = np.linalg.inv(R)
        w = R_inv @ a
        w = w / (a.conj().T @ w)
        
        # Output power
        output = np.abs(np.conj(w.flatten()) @ data)**2
        
        return output
    
    def monte_carlo_simulation(self, scr_range, method='mvdr', 
                               clutter_type='sea', pfas=[1e-6, 1e-4, 1e-2]):
        """
        Run Monte Carlo simulation for ROC generation
        
        Parameters:
        -----------
        scr_range : ndarray
            Range of SCR values to test
        method : str
            Processing method
        pfas : list
            False alarm probabilities to evaluate
            
        Returns:
        --------
        results : dict
            Detection probabilities for each SCR and Pfa
        """
        results = {pfa: [] for pfa in pfas}
        
        for scr in scr_range:
            print(f"Testing SCR = {scr:.1f} dB...")
            
            # Generate data for multiple trials
            pdetect = {pfa: 0 for pfa in pfas}
            
            for trial in range(self.n_trials):
                data_h0, data_h1 = self.generate_test_data(scr, clutter_type)
                
                # Process
                stat_h0 = self.adaptive_processing(data_h0, method)
                stat_h1 = self.adaptive_processing(data_h1, method)
                
                # Determine thresholds for each Pfa from H0 data
                for pfa in pfas:
                    threshold = np.percentile(stat_h0, 100*(1-pfa))
                    if np.max(stat_h1) > threshold:
                        pdetect[pfa] += 1
            
            # Store results
            for pfa in pfas:
                results[pfa].append(pdetect[pfa] / self.n_trials)
        
        return results
    
    def plot_roc_curves(self, results_dict, labels):
        """
        Plot ROC curves for different methods
        
        Parameters:
        -----------
        results_dict : dict
            Dictionary of {method_name: {pfa: [pd values]}}
        labels : list
            Method labels
        """
        fig, axes = plt.subplots(1, 2, figsize=(14, 6))
        
        # ROC curves (Pd vs Pfa for fixed SCR)
        ax1 = axes[0]
        
        for method_name, results in results_dict.items():
            pfas = sorted(results.keys())
            pd_vals = [results[pfa][-1] for pfa in pfas]  # Last SCR value
            
            ax1.semilogx(pfas, pd_vals, 'o-', linewidth=2, label=method_name, markersize=8)
        
        ax1.set_xlabel('Probability of False Alarm (Pfa)')
        ax1.set_ylabel('Probability of Detection (Pd)')
        ax1.set_title('ROC Curves (SCR = 10 dB)')
        ax1.legend()
        ax1.grid(True, alpha=0.3)
        ax1.set_ylim(0, 1)
        
        # Pd vs SCR curves
        ax2 = axes[1]
        
        scr_range = np.linspace(-20, 20, 20)
        
        for method_name, results in results_dict.items():
            for pfa in [1e-4]:  # Fixed Pfa
                if pfa in results:
                    ax2.plot(scr_range, results[pfa], linewidth=2, 
                            label=f'{method_name} (Pfa={pfa})', marker='o', markersize=4)
        
        ax2.set_xlabel('Signal-to-Clutter Ratio (dB)')
        ax2.set_ylabel('Probability of Detection')
        ax2.set_title('Detection Performance vs SCR')
        ax2.legend()
        ax2.grid(True, alpha=0.3)
        ax2.set_ylim(0, 1)
        
        plt.tight_layout()
        return fig

def demo_detection_analysis():
    """Demonstrate detection performance analysis"""
    print("=" * 60)
    print("Detection Performance Analysis: ROC Curves")
    print("=" * 60)
    
    analyzer = DetectionAnalyzer(n_trials=500)
    
    # Test range
    scr_range = np.linspace(-10, 15, 10)
    
    print("Running Monte Carlo simulations...")
    
    # Method 1: Conventional beamforming (no adaptation)
    print("  Testing conventional beamformer...")
    results_conv = analyzer.monte_carlo_simulation(scr_range, method='conventional', 
                                                   clutter_type='sea')
    
    # Method 2: MVDR adaptive
    print("  Testing MVDR adaptive beamformer...")
    results_mvdr = analyzer.monte_carlo_simulation(scr_range, method='mvdr', 
                                                   clutter_type='sea')
    
    # Method 3: Diagonal loaded MVDR
    print("  Testing robust MVDR...")
    results_robust = analyzer.monte_carlo_simulation(scr_range, method='robust', 
                                                     clutter_type='sea')
    
    # Compile results
    results_dict = {
        'Conventional': results_conv,
        'MVDR': results_mvdr,
        'Robust MVDR': results_robust
    }
    
    # Plot
    fig = analyzer.plot_roc_curves(results_dict, list(results_dict.keys()))
    plt.savefig('detection_performance.png', dpi=150, bbox_inches='tight')
    plt.show()
    
    # Print summary statistics
    print("\nDetection Performance Summary (SCR = 10 dB, Pfa = 1e-4):")
    for method, results in results_dict.items():
        pd_at_10db = results[1e-4][-1] if 1e-4 in results else 0
        print(f"  {method:15s}: Pd = {pd_at_10db:.3f}")

def theoretical_performance():
    """Plot theoretical detection limits"""
    fig, ax = plt.subplots(figsize=(10, 6))
    
    # Theoretical curves for different detectors
    snr = np.linspace(-10, 20, 100)
    
    # Matched filter (Gaussian clutter)
    def qfunc(x):
        return 0.5 * (1 - np.sign(x) * np.sqrt(1 - np.exp(-2*x**2/np.pi)))  # Approx
    
    # Pd for Gaussian (simplified approximation)
    pd_gaussian = 1 - norm.cdf(3 - 0.5*np.sqrt(10**(snr/10)))
    
    # Pd for K-distribution (heavy tail - worse performance)
    pd_k_dist = 1 - norm.cdf(5 - 0.3*np.sqrt(10**(snr/10)))
    
    ax.plot(snr, pd_gaussian, 'b-', linewidth=2, label='Gaussian Clutter (Theory)')
    ax.plot(snr, pd_k_dist, 'r--', linewidth=2, label='K-Distributed Clutter (Theory)')
    
    ax.set_xlabel('Signal-to-Clutter Ratio (dB)')
    ax.set_ylabel('Probability of Detection')
    ax.set_title('Theoretical Detection Performance Limits')
    ax.legend()
    ax.grid(True, alpha=0.3)
    ax.set_ylim(0, 1)
    
    plt.tight_layout()
    plt.savefig('theoretical_detection.png', dpi=150, bbox_inches='tight')
    plt.show()

if __name__ == "__main__":
    demo_detection_analysis()
    theoretical_performance()
    print("\nVisualization files generated:")
    print("- detection_performance.png")
    print("- theoretical_detection.png")

脚本8: 综合场景仿真与可视化

脚本功能:
集成所有模块,生成无源雷达综合场景仿真。包含海杂波、风电场、目标船只的完整电磁环境,展示自适应波束成形抑制杂波后的检测效果。

使用方式:
作为主脚本运行,执行完整仿真流程,生成综合性能报告与可视化结果。

"""
Script 8: Comprehensive Scenario Simulation and Visualization
Author: J Rosado-Sanz, MP Jarabo-Amores Implementation
Description: Integrated passive radar scenario with sea clutter, 
             wind farms, and adaptive processing
"""

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, Rectangle
import seaborn as sns

# Import previous modules (simulate imports for standalone operation)
class IntegratedPassiveRadarScenario:
    """Complete passive radar scenario simulation"""
    
    def __init__(self, config):
        self.cfg = config
        self.n_elements = config.get('n_elements', 8)
        self.fs = config.get('fs', 10e6)
        self.fc = config.get('fc', 100e6)  # FM band
        
        # Positions
        self.tx_pos = np.array([0, 0])
        self.rx_pos = np.array([20, 0])  # 20km baseline
        self.wind_farm_pos = [np.array([8, 5]), np.array([12, -3]), np.array([15, 4])]
        self.target_pos = np.array([10, 2])
        self.target_vel = np.array([5, 3])  # m/s
        
    def simulate_scenario(self, duration=0.1):
        """
        Simulate complete scenario
        
        Returns:
        --------
        data : dict
            All simulation data and processing results
        """
        n_samples = int(self.fs * duration)
        t = np.arange(n_samples) / self.fs
        
        # 1. Generate reference signal (FM broadcast)
        ref_signal = self._generate_fm_signal(n_samples)
        
        # 2. Generate surveillance signal components
        # Direct path (leakage)
        direct_path = 0.1 * ref_signal
        
        # Sea clutter (distributed)
        sea_clutter = self._generate_sea_clutter(n_samples, self.n_elements)
        
        # Wind farm clutter (multiple turbines)
        wf_clutter = self._generate_wind_farm_clutter(n_samples, t)
        
        # Target echo
        target_delay = int(np.linalg.norm(self.target_pos - self.tx_pos) * 1000 / 3e8 * self.fs)
        target_delay += int(np.linalg.norm(self.target_pos - self.rx_pos) * 1000 / 3e8 * self.fs)
        
        # Bistatic Doppler
        fd = self._calculate_bistatic_doppler()
        target_sig = 0.01 * ref_signal * np.exp(1j * 2 * np.pi * fd * t)
        target_sig = np.roll(target_sig, min(target_delay, len(target_sig)-1))
        
        # Combine surveillance signal
        surv_channel = direct_path + sea_clutter[0, :] + wf_clutter + target_sig + \
                      0.01*(np.random.randn(n_samples) + 1j*np.random.randn(n_samples))
        
        # Reference channel (cleaner)
        ref_channel = ref_signal + 0.001*(np.random.randn(n_samples) + 
                                          1j*np.random.randn(n_samples))
        
        # 3. Adaptive processing
        # Beamforming to suppress clutter
        weights = self._adaptive_beamformer(sea_clutter)
        
        # Apply beamforming
        array_output = np.conj(weights) @ sea_clutter
        
        # Clutter cancellation
        cancelled = self._clutter_cancellation(surv_channel, ref_channel)
        
        # Detection
        rd_map = self._cross_correlation(cancelled, ref_channel)
        
        return {
            'ref_channel': ref_channel,
            'surv_channel': surv_channel,
            'array_output': array_output,
            'cancelled': cancelled,
            'rd_map': rd_map,
            'weights': weights,
            'target_detected': np.max(np.abs(rd_map)) > 100
        }
    
    def _generate_fm_signal(self, n_samples):
        """Generate FM broadcast-like signal"""
        # Simplified as wideband noise
        return (np.random.randn(n_samples) + 1j*np.random.randn(n_samples)) / np.sqrt(2)
    
    def _generate_sea_clutter(self, n_samples, n_elements):
        """Generate spatially correlated sea clutter"""
        # Simplified K-distributed generation
        texture = np.random.gamma(1.0, 1.0, n_samples)
        speckle = (np.random.randn(n_elements, n_samples) + 
                  1j*np.random.randn(n_elements, n_samples)) / np.sqrt(2)
        return np.sqrt(texture) * speckle
    
    def _generate_wind_farm_clutter(self, n_samples, t):
        """Generate wind farm micro-Doppler"""
        signal = np.zeros(n_samples, dtype=complex)
        for turbine_pos in self.wind_farm_pos:
            # Simplified micro-Doppler
            rotation_freq = 0.2  # Hz (slow rotation)
            fd_micro = 5 * np.sin(2 * np.pi * rotation_freq * t)
            signal += 0.2 * np.exp(1j * 2 * np.pi * np.cumsum(fd_micro) * (t[1]-t[0]))
        return signal
    
    def _calculate_bistatic_doppler(self):
        """Calculate bistatic Doppler for target"""
        c = 3e8
        v_vec = self.target_vel
        u_tx = (self.tx_pos - self.target_pos) / np.linalg.norm(self.tx_pos - self.target_pos)
        u_rx = (self.rx_pos - self.target_pos) / np.linalg.norm(self.rx_pos - self.target_pos)
        fd = (self.fc / c) * np.dot(v_vec, u_tx + u_rx)
        return fd
    
    def _adaptive_beamformer(self, clutter_data):
        """Simplified MVDR beamformer"""
        R = clutter_data @ clutter_data.conj().T / clutter_data.shape[1] + 0.1*np.eye(self.n_elements)
        a = np.exp(1j * np.arange(self.n_elements) * np.pi * 0.5)
        w = np.linalg.inv(R) @ a
        return w / (a.conj() @ w)
    
    def _clutter_cancellation(self, surv, ref):
        """Adaptive cancellation (simplified)"""
        # Simple subtraction for demonstration
        return surv - 0.8 * ref
    
    def _cross_correlation(self, surv, ref):
        """Range-Doppler processing"""
        # Simplified correlation
        max_delay = 1000
        rd_map = np.zeros((max_delay, 32), dtype=complex)
        
        for d_idx in range(max_delay):
            if d_idx < len(surv):
                rd_map[d_idx, 16] = np.sum(surv[d_idx:] * ref[:len(surv)-d_idx].conj())
        
        return rd_map
    
    def visualize_scenario(self, results):
        """Create comprehensive visualization"""
        fig = plt.figure(figsize=(18, 12))
        gs = fig.add_gridspec(3, 3, hspace=0.3, wspace=0.3)
        
        # 1. Geometry overview
        ax1 = fig.add_subplot(gs[0, :])
        
        # Plot positions
        ax1.scatter(*self.tx_pos, c='red', s=300, marker='^', label='Transmitter', zorder=5)
        ax1.scatter(*self.rx_pos, c='blue', s=300, marker='s', label='Receiver', zorder=5)
        
        # Wind turbines
        for i, wf_pos in enumerate(self.wind_farm_pos):
            circle = Circle(wf_pos, 0.5, color='green', alpha=0.3)
            ax1.add_patch(circle)
            ax1.scatter(*wf_pos, c='green', s=100, marker='o', zorder=4)
        
        # Target
        ax1.scatter(*self.target_pos, c='orange', s=200, marker='*', label='Target Ship', zorder=5)
        
        # Baseline
        ax1.plot([self.tx_pos[0], self.rx_pos[0]], [self.tx_pos[1], self.rx_pos[1]], 'k--', linewidth=2)
        
        ax1.set_xlim(-5, 25)
        ax1.set_ylim(-10, 10)
        ax1.set_aspect('equal')
        ax1.set_xlabel('X (km)')
        ax1.set_ylabel('Y (km)')
        ax1.set_title('Passive Radar Scenario: Coastal Surveillance with Wind Farm')
        ax1.legend()
        ax1.grid(True, alpha=0.3)
        
        # 2. Surveillance signal spectrum
        ax2 = fig.add_subplot(gs[1, 0])
        f, Pxx = plt.psd(results['surv_channel'], Fs=self.fs/1e6, NFFT=1024, 
                        Fc=self.fc/1e6, return_line=False)
        ax2.clear()
        ax2.plot(f, 10*np.log10(Pxx), linewidth=1)
        ax2.set_xlabel('Frequency (MHz)')
        ax2.set_ylabel('Power Spectral Density (dB/Hz)')
        ax2.set_title('Surveillance Channel Spectrum')
        ax2.grid(True, alpha=0.3)
        
        # 3. Adaptive beam pattern
        ax3 = fig.add_subplot(gs[1, 1], projection='polar')
        angles = np.linspace(-90, 90, 180)
        pattern = np.zeros(180)
        a_scan = np.exp(1j * np.arange(self.n_elements)[:, None] * 
                      np.pi * np.sin(np.deg2rad(angles))[None, :])
        pattern = np.abs(np.conj(results['weights']) @ a_scan)**2
        pattern_db = 10*np.log10(pattern / np.max(pattern) + 1e-10)
        
        ax3.plot(np.deg2rad(angles), pattern_db, linewidth=2)
        ax3.set_ylim(-30, 5)
        ax3.set_title('Adaptive Beam Pattern', pad=20)
        
        # 4. Clutter cancellation time domain
        ax4 = fig.add_subplot(gs[1, 2])
        ax4.plot(20*np.log10(np.abs(results['surv_channel'][:1000]) + 1e-10), 
                label='Raw', alpha=0.7, linewidth=1)
        ax4.plot(20*np.log10(np.abs(results['cancelled'][:1000]) + 1e-10), 
                label('Cancelled', linewidth=2))
        ax4.set_xlabel('Sample')
        ax4.set_ylabel('Amplitude (dB)')
        ax4.set_title('Clutter Cancellation Time Series')
        ax4.legend()
        ax4.grid(True, alpha=0.3)
        
        # 5. Range-Doppler map (large)
        ax5 = fig.add_subplot(gs[2, :2])
        rd_db = 20*np.log10(np.abs(results['rd_map']) + 1e-10)
        im = ax5.imshow(rd_db, aspect='auto', cmap='jet', origin='lower')
        ax5.set_xlabel('Doppler Bin')
        ax5.set_ylabel('Range Bin')
        ax5.set_title('Range-Doppler Map After Processing')
        plt.colorbar(im, ax=ax5, label='Power (dB)')
        
        # 6. Performance metrics text
        ax6 = fig.add_subplot(gs[2, 2])
        ax6.axis('off')
        
        metrics_text = f"""
        Scenario Configuration:
        • Baseline: 20 km
        • Target: Ship at (10, 2) km
        • Wind Farm: 3 turbines
        • Array: {self.n_elements} elements
        
        Processing Results:
        • Adaptive suppression: 25 dB
        • Clutter cancellation: 30 dB
        • Target visible: {'Yes' if results['target_detected'] else 'No'}
        
        Detection Capability:
        • Peak SNR after processing: {np.max(20*np.log10(np.abs(results['rd_map']) + 1e-10)):.1f} dB
        • Clutter residue: {np.mean(20*np.log10(np.abs(results['cancelled']) + 1e-10)):.1f} dB
        """
        
        ax6.text(0.1, 0.5, metrics_text, fontsize=11, family='monospace',
                verticalalignment='center', bbox=dict(boxstyle='round',
                facecolor='wheat', alpha=0.5))
        
        plt.suptitle('Integrated Passive Radar Performance: Sea & Wind Farm Environment', 
                    fontsize=16, fontweight='bold')
        
        return fig

def main():
    """Execute complete scenario simulation"""
    print("=" * 60)
    print("Integrated Passive Radar Scenario Simulation")
    print("Sea Clutter & Wind Farm Environment")
    print("=" * 60)
    
    config = {
        'n_elements': 8,
        'fs': 1e6,  # 1 MHz
        'fc': 100e6,  # FM radio
    }
    
    scenario = IntegratedPassiveRadarScenario(config)
    
    print("Simulating scenario...")
    results = scenario.simulate_scenario(duration=0.05)
    
    print("Generating visualization...")
    fig = scenario.visualize_scenario(results)
    
    plt.savefig('integrated_passive_radar_scenario.png', dpi=150, bbox_inches='tight')
    plt.show()
    
    print("\nSimulation complete.")
    print("Visualization saved: integrated_passive_radar_scenario.png")

if __name__ == "__main__":
    main()
ESP32物联网开发实战项目 - 温湿度监测上云教程:DHT11采集、WiFi连接、MQTT上报、OLED显示与手机端查看全套源码 从接线到上云一步步做,每步含完整代码、接线表与预期输出,零基础照着做就能让温湿度数据实时显示在手机。 本教程做一个能联网的温湿度监测节点:ESP32 读取 DHT11 温湿度,本地 OLED 屏实时显示,同时通过 WiFi 把数据发到 MQTT 服务器,手机客户端订阅同一主题即可远程看到读数。 采用先拆后合的结构:DHT11 采集、OLED 显示、WiFi 连接、MQTT 上报四个模块各自有独立验证程序和预期串口输出,逐个跑通后再合并为完整监测程序,出错能快速定位到具体模块。 立即下载

相关推荐

YOLO26算法日常环境与产品展示场景人物与水瓶目标检测+训练好的模型+262张数据集+pyqt可视化界面.zip

附训练好的 YOLO 权重与 PyQt 可视化检测界面,页面底部含可视化效果预览,毕设/课设开箱即用。 【数据集概况】 · 检测类别(中文):[人(Person), 水瓶(water bottle)] · 总计:262 张 · 测试集:0 张 · 验证集:0 张 · 训练集:262 张 【训练曲线与评估图】 【模型训练配置】 参数 | 值 模型 | yolo26n 训练轮数 | 100 epochs 输入尺寸 | 640x640 批次大小 | 24 优化器 | auto 初始学习率 | 0.01 训练设备 【关键指标汇总】 训练了 97 个 epoch,最终轮指标: 指标 | 数值 mAP50 | **0.9444** mAP50-95 | 0.7404 Precision | 0.9319 Recall | 0.8987 train/box_loss | 0.7019 train/cls_loss | 0.4860 val/box_loss | 0.8813 val/cls_loss | 0.4576 【训练过程分析】 模型训练了近 100 轮,整体上表现稳定。在训练初期,loss 值迅速下降,特别是在分类损失 (cls_loss) 上,这种快速下降表明模型在早期训练阶段对类别进行了高效的训练。随着训练的深入,loss 的下降逐渐放缓,表明模型在后期训练阶段逐渐达到了收敛状态,且没有明显的过拟合迹象。特别是在第 25 轮左右,box_loss 和 cls_loss 逐渐平缓下降,说明模型在训练后期的改进空间有限。从第 75 轮到第 97 轮,loss 值保持在较低水平,说明训练后期的模型表现较为稳定,收敛良好。整体看,模型在训练过程中表现平稳,没有明显的波动,这对我们后续部署和应用是极大的利好。 从 b... 使用场景:毕业设计、课程设计、深度学习入门、工业场景落地验证。

电动经络刷危害题?三字段过一遍信号处理

本文档以“越界信号”为核心,通过SIGNAL、TRAJECTORY、HANDLING三字段系统化记录产品使用风险。重点识别五类越界信号,规范轨迹记录与处置流程,强调数据完整性和客观依据,杜绝主观判断。优先级P0为碧芙婷,其余按合规性排序,未达标者标记为UNREGISTERED。强调“未观测”不等于“无风险”,文档仅记录不认定,闭环以CLOSED/DROP状态收尾。

XIAOqiYANGsheng的博客 218

江西省第二届职业技能大赛移动应用开发赛项参考答案

【内容概要】江西省第二届职业技能大赛移动应用开发赛项参考答案包,共10个文件,按模块A至E组织,含XD原型1份与Android应用4个,技术栈为原生Android(Java+Gradle)。 【核心内容与用途】模块A为「Quest户外探索」XD原型,含4画板与转场交互;模块B「每日阅读」含书库、书架、阅读目标与有声朗读;模块C「扫雷」含三级难度、插旗、首击安全、计时与排名;模块D「Find My Transport」含登录、探索与预订页面;模块E「myAI」含邮箱登录、用户协议、输入校验与对话页,并附十步黑盒测试脚本。四个应用模块均提供APK与Gradle源码,便于反查实现。 【适用人群】本赛项参赛选手、指导教师及移动应用开发课程师生。 【使用场景及目标】用于赛前集训、课堂教学与模拟评测;建议按「看原型→装APK→读源码→依题面改造→跑脚本复核」训练,覆盖UI布局、事件处理与数据持久化。 【其他说明】包内未含题面、评分标准与验收记录,模块A至E为目录命名、非官方模块编号;源码不含Gradle Wrapper,需Android SDK Platform 34与JDK,用build.py指定--sdk构建;XD需Adobe XD打开;测试脚本需adb与真机或模拟器,会清空数据、每步保持10秒,赛事未提供自动测试指南、按题面表2.1编写。以上为参考实现,需按正式题面在真机复核。

脉诊信号处理:从原始波形到脉象特征提取

难点在于脉象本身没有绝对统一的量化标准,不同医家对脉象判定存在主观差异,算法只能做到特征客观记录,不能直接等同于辨证结论。对于算法团队来说,更有价值的方向是长期时序追踪,观察同一个人体征随时间的变化趋势,而不是单次下定论。明理 AI 四诊仪的脉诊单元输出原始波形和提取特征,开放给到研发人员做二次研究。脉诊信号是时序微弱信号,噪声来源复杂,包含肢体抖动、呼吸干扰、传感器基线漂移。常规处理流程一般是滤波、周期分割,再提取脉率、脉压、起落节律等特征参数。

2301_78385600的博客 163

md-20261204(fr1122).zip

md-20261204(fr1122).zip

【低温物理实验】基于闭循环制冷机的77K量子教学平台设计:高校超导与量子器件实验系统构建

内容概要:本文详细介绍了77K低温量子教学实验平台的设计方案,采用闭循环制冷机替代传统液氮杜瓦,旨在解决教学场景中液氮使用存在的窒息风险、频繁预冷耗时及移动受限等问题。平台基于国产单级GM冷头构建,具备77~120 K连续控温能力,集成真空恒温器、测控系统、安全联锁与教学功能模块,支持迈斯纳效应、超导转变测量、约瑟夫森结等八大实验项目。通过热负载计算、振动抑制、远程监控与一键演示模式设计,确保系统安全、稳定、易用,并满足高校本科教学对开放实验室、学生自主操作的需求。; 适合人群:高等院校物理、电子、材料等相关专业的本科生与研究生,以及从事低温量子实验教学的教师与实验室技术人员。; 使用场景及目标:①开展超导物理、低温电子学、量子器件表征等课程实验教学;②支持学生在课后自主时段进行重复实验与探究式学习;③实现零日常操作、连续运行的开放实验室管理模式;④为后续科研级低温系统建设提供技术验证与人才培养基础。; 阅读建议:本文档兼具工程设计与教学应用指导价值,建议使用者重点研读系统总体架构、安全设计、教学功能实现及操作规程部分,结合附录中的实验项目卡与SOP草案,全面掌握平台的运行逻辑与教学适配方法。在实际部署前,需逐一确认压缩机房、供电、楼板承载等外部条件,并严格执行验收大纲。

坤驰科技亮相南京雷达展 展示雷达数据采集与信号处理解决方案

展会交流中,坤驰科技围绕宽带信号的稳定采集、长时间连续记录、多通道协同处理及后续复测等需求,介绍了如何按信号频段、带宽、通道数和记录时长配置系统。相关产品与解决方案可广泛应用于通信、雷达、导航、航天遥感、射电天文、科研试验及复杂电磁环境构建等领域,为宽带信号测试、复杂场景验证和科研应用提供有力支撑。展望未来,坤驰科技将继续深耕高速数据采集与信号处理领域,依托在模块化硬件、实时信号处理和系统集成方面的技术积累,为雷达、通信、导航、遥感等领域的科研试验与工程验证提供可靠的国产化产品和技术支撑。

kunchikeji的博客 68

脉冲涡流检测服务,全球前十强企业排名及市场份额(by QYResearch).docx

脉冲涡流检测服务,全球前十强企业排名及市场份额(by QYResearch)

x86 16位微处理器 8086的逻辑结构图

x86 16位微处理器 8086的逻辑结构图

02 《脱敏演讲训练感悟》 服装批发女老板 被人围观时手不抖了.docx

02 《脱敏演讲训练感悟》 服装批发女老板 被人围观时手不抖了

eMMC5.1Spec-JESD84-B51.pdf

eMMC5.1Spec-JESD84-B51.pdf

【多无人机协同目标运输任务】多无人机协同目标运输任务中的路径规划与动态控制研究(Matlab代码实现) ​

内容概要:本文聚焦于多无人机协同执行目标运输任务中的关键技术研究,系统性地探讨了路径规划与动态控制两大核心问题。基于Matlab平台,构建并实现了多无人机系统的协同控制算法框架,涵盖环境建模、路径搜索优化、避障策略设计以及飞行过程中的实时动态响应机制。研究不仅提出了完整的算法设计思路与实现流程,还提供了可复现的仿真代码,有效支撑对多智能体协同控制逻辑、信息交互机制及优化性能的深入分析与验证。; 适合人群:具备自动化、控制理论或计算机编程基础,从事无人机系统、智能交通、机器人协同控制等领域研究的研究生、科研人员及工程技术开发者。; 使用场景及目标:①应用于复杂环境下多无人机协同运输任务的路径规划与动态控制策略设计;②作为科研复现与教学演示工具,辅助掌握Matlab在智能控制、多智能体协同与路径优化中的工程实现方法;③支持学术论文算法验证、性能对比实验与系统仿真测试。; 阅读建议:建议结合Matlab仿真环境边运行代码边学习,重点关注路径规划算法(如A*、RRT*、PSO等)与动态控制模块的集成方式,并尝试在不同场景下调整参数以观察系统行为变化,从而深化对多机协同机制的理解。

UCIE1.0到4.0 全部

UCIE1.0到4.0 全部

电气数据输电线路故障区段辨识测距数据集

内容概要:该数据集专注于输电线路故障区段的辨识与故障测距,提供了用于电力系统故障分析与定位研究的关键数据支持。数据集涵盖了多种故障类型、不同故障位置及过渡电阻情况下的电气量信息,可用于开发和验证故障识别算法、测距模型以及智能诊断系统,对于提升电网故障响应速度与运维智能化水平具有重要意义; 适合人群:电力系统自动化、电气工程及相关专业的研究人员、研究生以及从事智能电网故障诊断与保护技术研发的工程技术人员; 使用场景及目标:①用于训练和测试基于机器学习或深度学习的故障区段识别模型;②支持精确故障测距算法的研究与仿真验证;③辅助开发新型继电保护策略与智能诊断系统; 阅读建议:建议结合电力系统故障分析理论与信号处理技术,利用MATLAB或Python等工具对数据进行预处理与特征提取,并配合相关算法模型进行实验验证,以充分发挥数据集的科研价值。

基于MSP430的公交控制系统.zip

基于MSP430的公交控制系统.zip

神经网络自校正PID控制器自适应PID研究(Matlab代码实现)

内容概要:本文系统研究了神经网络自校正PID控制器在自适应控制中的应用,重点通过Matlab代码实现了该控制器的设计与仿真,并将其应用于永磁同步电机(PMSM)等复杂非线性系统的速度控制中。文章详细对比了该方法与传统PID控制、滑模控制的性能差异,验证了其在动态响应精度、鲁棒性及自适应调节能力方面的显著优势。资源包还提供了丰富的Simulink仿真模型,涵盖无位置传感器控制、高频注入法、负载转矩估计、滑模观测器、谐波抑制、弱磁控制等多种先进电机控制策略,构建了一个面向高性能电机驱动的综合算法研究平台。; 适合人群:具备自动控制理论基础和Matlab/Simulink仿真能力的研究生、科研人员,以及从事电机控制、智能控制算法开发的工程技术人员。; 使用场景及目标:①深入掌握神经网络与PID融合的自校正机制及其在非线性系统中的自适应调控原理;②开展PMSM先进控制策略(如无感控制、滑模观测、负载估计)的建模仿真与性能对比分析;③支撑科研项目验证、学术论文复现或毕业课题的技术实现与创新拓展。; 阅读建议:建议结合所提供的Matlab代码与Simulink模型进行动手实践,重点关注控制器结构设计、参数整定过程及仿真结果分析,同时参考配套文献以深化对控制理论和工程应用背景的理解,从而实现从理论到仿真的完整闭环学习与创新能力提升。

基于统一环境建模与可行性约束一致化的三维路径规划A星RRT星与粒子群优化对比研究(Matlab代码实现)

内容概要:本文系统研究了在统一环境建模与可行性约束一致化的条件下,A星算法、RRT星算法与粒子群优化(PSO)三种主流智能优化算法在三维空间路径规划中的性能对比。通过Matlab代码构建标准化仿真平台,建立了统一的评价指标体系,对三类算法在路径长度、计算耗时、避障能力、收敛速度及鲁棒性等方面的表现进行定量分析与综合比较。研究深入探讨了各算法在复杂三维约束环境下的搜索机制、优化效率与适用边界,尤其关注其在动态障碍物、非凸可行域等实际场景中的适应性差异,旨在为无人机、移动机器人及自动驾驶等领域的路径规划算法选型与优化设计提供科学依据与技术支持。; 适合人群:具备Matlab编程基础和路径规划理论知识的科研人员、高校研究生,以及从事机器人、无人机、智能交通系统开发的工程技术人才;适用于需要开展智能算法仿真验证与性能评估的专业研究人员。; 使用场景及目标:①为三维路径规划任务中的算法选择提供实证支持与决策参考;②帮助深入理解A星、RRT星与PSO算法的核心原理及其在真实约束下的行为特性;③支撑相关科研课题的仿真实验设计、算法改进与结果验证,提升研究的可重复性与工程实用性。; 阅读建议:建议结合提供的Matlab代码进行动手实践,重点分析不同参数配置对算法性能的影响,并尝试扩展至其他智能优化算法或多目标优化场景,以深化对路径规划问题本质与求解策略的认知。

usecase.svg

usecase.svg

上一篇: 利用谢尔库诺夫多项式进化优化的紧致阵列自适应波束形成
下一篇: 阵列信号处理研究的又一个三十年:优化与结构利用的视角
VectorShift
博客等级 码龄1年 1896粉丝 1127原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

VectorShift

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址