jamming_signal_algo_20250421174049.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import numpy as np
  2. class JammingSignalAlgo:
  3. @staticmethod
  4. def frequency_modulation(bandwidth, duration, sample_rate, modulation_index=0.5):
  5. """噪声调频干扰算法"""
  6. t = np.arange(0, duration, 1/sample_rate)
  7. baseband = np.random.normal(0, 1, len(t))
  8. modulated = np.sin(2 * np.pi * bandwidth * t + modulation_index * np.cumsum(baseband))
  9. return modulated
  10. @staticmethod
  11. def repeater_jamming(bandwidth, duration, sample_rate, delay=0.1, attenuation=0.5):
  12. """转发式干扰算法"""
  13. t = np.arange(0, duration, 1/sample_rate)
  14. original_signal = np.sin(2 * np.pi * bandwidth * t)
  15. return attenuation * np.roll(original_signal, int(delay * sample_rate))
  16. @staticmethod
  17. def velocity_deception(bandwidth, duration, sample_rate, doppler_shift=1000):
  18. """速度欺骗干扰算法"""
  19. t = np.arange(0, duration, 1/sample_rate)
  20. return np.sin(2 * np.pi * (bandwidth + doppler_shift) * t)
  21. @staticmethod
  22. def range_deception(bandwidth, duration, sample_rate, fake_range=500):
  23. """距离欺骗干扰算法"""
  24. t = np.arange(0, duration, 1/sample_rate)
  25. fake_delay = 2 * fake_range / 3e8 # 计算双程时延
  26. return np.sin(2 * np.pi * bandwidth * (t - fake_delay))
  27. @staticmethod
  28. def amplitude_modulation(bandwidth, duration, sample_rate, modulation_depth=0.8):
  29. """噪声调幅干扰算法"""
  30. t = np.arange(0, duration, 1/sample_rate)
  31. carrier = np.cos(2 * np.pi * bandwidth * t)
  32. noise = np.random.normal(0, 1, len(t))
  33. modulated = (1 + modulation_depth * noise) * carrier
  34. return modulated