123456789101112131415161718192021222324252627 |
- import numpy as np
- class JammingSignalAlgo:
- @staticmethod
- def generate_noise_jam(bandwidth, duration, sample_rate):
- num_samples = int(duration * sample_rate)
- return np.random.normal(0, 1, num_samples)
- @staticmethod
- def generate_amplitude_noise_jam(bandwidth, duration, sample_rate):
- t = np.arange(0, duration, 1/sample_rate)
- carrier = np.sin(2 * np.pi * bandwidth * t)
- noise = 0.5 * np.random.normal(0, 1, len(t))
- return carrier * noise
- @staticmethod
- def generate_velocity_deceptive_jam(bandwidth, duration, sample_rate):
- t = np.arange(0, duration, 1/sample_rate)
- phase_shift = np.cumsum(np.random.uniform(-0.1, 0.1, len(t)))
- return np.sin(2 * np.pi * bandwidth * t + phase_shift)
- @staticmethod
- def generate_deceptive_jam(bandwidth, duration, sample_rate):
- t = np.arange(0, duration, 1/sample_rate)
- delay = np.random.uniform(0.1, 0.5) # 随机延迟0.1-0.5秒
- amplitude = np.random.uniform(0.5, 2.0) # 随机幅度调制
- return amplitude * np.sin(2 * np.pi * bandwidth * (t - delay))
|