torchsig.signals.builders.fm.fm_modulator

torchsig.signals.builders.fm.fm_modulator(bandwidth: float, sample_rate: float, num_samples: int, rng: Generator | None = None) ndarray[source]

Frequency Modulator (FM) signal generator.

Generates FM signals using Carson’s Rule for bandwidth calculation.

Parameters:
  • bandwidth – Desired 3 dB bandwidth of the signal (Hz).

  • sample_rate – Sampling rate for the IQ signal (Hz).

  • num_samples – Number of IQ samples to produce.

  • rng – Random number generator for reproducibility. If None, creates a new default generator.

Returns:

FM modulated signal at the appropriate bandwidth.

Return type:

np.ndarray

Raises:
  • ValueError – If bandwidth or sample_rate are not positive.

  • ValueError – If bandwidth exceeds sample_rate/2.

  • ValueError – If num_samples is not positive.

Examples

>>> rng = np.random.default_rng(42)
>>> fm_signal = fm_modulator(1000, 10000, 1000, rng)
>>> fm_signal.shape
(1000,)