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