torchsig.signals.builders.chirp.chirp

torchsig.signals.builders.chirp.chirp(f0: float, f1: float, samples_per_symbol: int, phi: float = 0.0) ndarray[source]

Generates a linear frequency modulated (LFM) chirp signal.

Creates a chirp waveform that linearly sweeps from frequency f0 to f1.

Parameters:
  • f0 – Starting frequency (Hz).

  • f1 – Ending frequency (Hz).

  • samples_per_symbol – Number of samples for the chirp symbol.

  • phi – Starting phase in degrees (default: 0).

Returns:

Complex-valued chirp waveform of shape (samples_per_symbol,).

Return type:

np.ndarray

Raises:
  • ValueError – If samples_per_symbol is not positive.

  • ValueError – If f0 or f1 are not finite numbers.

Examples

>>> chirp(100, 200, 100)
array([1.+0.j, 1.+0.j, ..., 1.+0.j], dtype=complex64)
>>> chirp(100, 200, 100, phi=45)
array([1.+0.j, 1.+0.j, ..., 1.+0.j], dtype=complex64)