# Discrete time sine wave generation near nyquist

I'm trying to wrap my head around how to generate sine-waves out of a DAC near the Nyquist frequency (or determining how close I can get for reliable results). So if I want to generate a 499 Hz sine wave using a 1 kSPS DAC, I will calculate each sample:

$$y(t) = \sin(2 \pi 499 \ t)$$

Converting this to discrete time:

$$y[k] = y\left( \tfrac{k}{1000} \right) = \sin \left(2 \pi 499 \frac{k}{1000} \right)$$

I end up with something like this:

The red line shows the 499 Hz signal, while the blue dots show the DAC sample. I get these large amplitude fluctuations. I know it's common to use a reconstruction filter to get rid of DAC images, which I always thought of as a low-pass filter from DC to Nyquist, which wouldn't really help get rid of the amplitude fluctuations...or would it?

Is there a better approach for generating sine waves? Or is there just simply a limit I cannot exceed (and what is the limit)?

• so this is a "conventional" DAC and not an oversampled sigma-delta DAC? if that is the case, and you really want to generate good sinusoids up to nearly Nyquist, you will need a helluva sharp brickwall LPF as an anti-imaging filter. – robert bristow-johnson Nov 19 '20 at 22:53
• oversampling (which is one of the techniques of sigma-delta) is far cheaper than an analog brick-wall LPF. – robert bristow-johnson Nov 19 '20 at 22:56

## 1 Answer

There's nothing wrong about this – it's absolutely what you should be seeing.

The sine wave is intact, if you applied a reconstruction filter – there's no amplitude fluctuation of the wave, as soon as you limit its bandwidth to the nyquist bandwidth, the analog signal "has" to follow the full sines.

• well, Marcus, there is something wrong with this. his anti-imaging filter isn't sharp enough, but that's a damn hard task for an analog filter. – robert bristow-johnson Nov 19 '20 at 22:55
• well, you're right about the realizability of the filter, but he's not using any filter at all so far. – Marcus Müller Nov 19 '20 at 22:56
• The output beating is 100% right! Look at the beat frequency: exactly the 1 Hz that's left between Nyquist and his oscillation. – Marcus Müller Nov 19 '20 at 22:59
• i am starting to suspect that this is not really about a DAC. it's more about mathematical reconstruction and the OP doesn't quite grok the reconstruction part of the sampling theorem. – robert bristow-johnson Nov 19 '20 at 23:04
• Looking at that, I think you're right. – Marcus Müller Nov 19 '20 at 23:09