Ok so as part of a project for school I have been designing an FIR bandpass filter. The output should have been a signal which looks like a sampled sinusoid but there was a strange alteration on the amplitude. I began to investigate and generated a signal with the same F/Fs. I noticed that signal also looks the same. Just to be clear, this has been my logic thus far: \begin{equation} s(t) = \sin(2\pi Ft) \end{equation} \begin{equation} s(nT) = \sin(2\pi FnT) ; t =nT \end{equation}

\begin{equation} s(n) = \sin(2\pi \frac{F}{F_s}n); F_s =\frac{1}{T} \end{equation}

For this particular sine wave $\frac{F}{F_s}=0.40625$. The output I get when generating with the following python code is:

def signal_gen(f, length):
    n = np.arange(0, length)
    return np.sin(2 * np.pi * f * n)
sig = signal_gen(0.40625, 2048)

Sine Wave with Strange Distortion

I have noticed that the distortion is not bad at all for lower values of $\frac{F}{F_s}$. Could anyone help to understand this distortion ? As far as I can tell it just seems to be that the sampling frequency is close to the frequency of the signal is approaching a point where aliasing will occur but I'm not 100% confident in that theory.


1 Answer 1


If you sample a sine reasonably close to Nyquist, you will get a vector of samples that «look» quite unlike a sine - depending on how your waveform visualizer do its thing.

An ideal D/A conversion should still produce a perfect sine (provided that file size is infinite).

  • 1
    $\begingroup$ To make this clear, this is true if you define "an ideal D/A conversion" to mean a conversion that includes a reconstruction filter. $\endgroup$
    – TimWescott
    Oct 19, 2022 at 23:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.