Skip to content

Inconsistency in the two-sided bandwidth with the Nyquist sampling theorem criterion #471

Description

@tapyu

Version

2.1.1 (Default)

System Information

not applied

Description

Based on the docstring of the signal builders

def fm_modulator(
bandwidth: float,
sample_rate: float,
num_samples: int,
rng: np.random.Generator | None = None,
) -> np.ndarray:
"""Frequency Modulator (FM) signal generator.
Generates FM signals using Carson's Rule for bandwidth calculation.
Args:
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.

It defines as the 3-dB bandwidth, but does not say whether it is two-sided or one-sided. When not specified, one may understand that the author makes the bandwidth cover the full frequency span. In this case, for a baseband signal, the bandwidth would be within [-B/2, B/2] Hz. In this case, the Nyquist sampling theorem criterion for no aliasing would be

$$ f_s \geq B $$

where $f_s$ is the sampling rate in Hz. However, in the same code you check

if bandwidth > sample_rate / 2:
raise ValueError("bandwidth must be less than sample_rate/2")

This is only consistent for one-side 3-dB bandwidth definition!

If you mean bandwidth B as the frequency for the range [-B, B] Hz, please, say that is a two-sided 3-dB bandwidth. Otherwise, your definition makes the bandwidth vague.

How to Reproduce the Bug

not applied

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions