12345678910111213141516171819202122232425262728293031323334353637383940 |
- import numpy as np
- class JammingSignalAlgo:
- @staticmethod
- def frequency_modulation(bandwidth, duration, sample_rate, modulation_index=0.5):
- """噪声调频干扰算法"""
- t = np.arange(0, duration, 1/sample_rate)
- baseband = np.random.normal(0, 1, len(t))
- modulated = np.sin(2 * np.pi * bandwidth * t + modulation_index * np.cumsum(baseband))
- return modulated
- @staticmethod
- def repeater_jamming(bandwidth, duration, sample_rate, delay=0.1, attenuation=0.5):
- """转发式干扰算法"""
- t = np.arange(0, duration, 1/sample_rate)
- original_signal = np.sin(2 * np.pi * bandwidth * t)
- return attenuation * np.roll(original_signal, int(delay * sample_rate))
- @staticmethod
- def velocity_deception(bandwidth, duration, sample_rate, doppler_shift=1000):
- """速度欺骗干扰算法"""
- t = np.arange(0, duration, 1/sample_rate)
- return np.sin(2 * np.pi * (bandwidth + doppler_shift) * t)
- @staticmethod
- def range_deception(bandwidth, duration, sample_rate, fake_range=500):
- """距离欺骗干扰算法"""
- t = np.arange(0, duration, 1/sample_rate)
- fake_delay = 2 * fake_range / 3e8 # 计算双程时延
- return np.sin(2 * np.pi * bandwidth * (t - fake_delay))
- @staticmethod
- def amplitude_modulation(bandwidth, duration, sample_rate, modulation_depth=0.8):
- """噪声调幅干扰算法"""
- t = np.arange(0, duration, 1/sample_rate)
- carrier = np.cos(2 * np.pi * bandwidth * t)
- noise = np.random.normal(0, 1, len(t))
- modulated = (1 + modulation_depth * noise) * carrier
- return modulated
|