jamming_signal_algo_20250421112937.py 779 B

1234567891011121314151617181920
  1. import numpy as np
  2. class JammingSignalAlgo:
  3. @staticmethod
  4. def generate_noise_jam(bandwidth, duration, sample_rate):
  5. num_samples = int(duration * sample_rate)
  6. return np.random.normal(0, 1, num_samples)
  7. @staticmethod
  8. def generate_amplitude_noise_jam(bandwidth, duration, sample_rate):
  9. t = np.arange(0, duration, 1/sample_rate)
  10. carrier = np.sin(2 * np.pi * bandwidth * t)
  11. noise = 0.5 * np.random.normal(0, 1, len(t))
  12. return carrier * noise
  13. @staticmethod
  14. def generate_velocity_deceptive_jam(bandwidth, duration, sample_rate):
  15. t = np.arange(0, duration, 1/sample_rate)
  16. phase_shift = np.cumsum(np.random.uniform(-0.1, 0.1, len(t)))
  17. return np.sin(2 * np.pi * bandwidth * t + phase_shift)