# Low frequency present on sampled waveform

I am trying to sample a 50kHz sinewave @ 200 ksps using a 16-bit ADS8517 ADC. I am having a problem in that there is a lower frequency signal present on my input signal as shown:

I have scoped the input and it is a perfect 50kHz 500mV signal. The ADC is setup for +/-10V and all circuits follow the datasheet. If I sample a 1kHz signal I get:

• Do you have an analog anti-aliasing filter? Are you sure your input sinewave is distortion free, i.e. no significant harmonics? Looks like something is aliasing to me. – John D Feb 14 '18 at 18:57
• I am driving directly from the scope just now so no anti-alias filter. I could try a simple RC one. It seems fairly clean. – smith1993 Feb 14 '18 at 19:02
• Any chance that the 200kHz sampling rate and the 50kHz signal are not exact, maybe off enough to create a 50Hz alias? – Taniwha Feb 14 '18 at 19:02
• It does it on lower frequencies as well. – smith1993 Feb 14 '18 at 19:04

There is no low frequency component there, and no screen resolution or sampling problem.

Shannon's theorem says you need at least 2 samples per cycle to represent the waveform accurately, and you have 4, so you are sampling it accurately.

HOWEVER:

Draw a sinewave, and mark 8 equally spaced sample points on it starting at 0, (at 45 degree intervals).

Now imagine the sinewave was sampled at 0, 90, 180 and 270 degrees; highlight those 4 samples and perhaps connect them with straight lines. Note the peak amplitude is the same as the peak amplitude of the original waveform.

Now repeat with the 45/135/225/315 degree set. Highlight and join with straight line. This time, you'll see the peak amplitude is 1/sqrt(2) of the original amplitude - yet both representations are correctly and accurately sampled representations of the original sine.

(First set : green points, second set, blue points)

All you're seeing in the first plot is this correct sampling drifting between these two forms, as your signal and sampling rate are not precisely frequency locked.

The reason that either the sampling points, or a straight line interpolation, don't appear to reproduce the original waveform correctly, is that their spectrum extends above the Nyquist limit (Fs/2).

If you correctly band-limited the reconstructed waveform, with BW less than FS/2, you would draw it as the smoothest possible curve between the points, (alternatively, you would low pass filter at FS/2 with a reconstruction filter - or interpolate using Whitaker's Function - another way of saying the same thing) and that smooth curve would, of course, be the original sine wave.

• So it is basically the effect of me sampling a sine wave at only 4x the frequency? The sampling will always become offset? The signal is passed through a 12th order bandpass IIR filter, rectified and then low pass filtered but the lumps are still present. – smith1993 Feb 14 '18 at 20:16
• See diagram (just added) for yourself. What you're doing is displaying the sampled points themselves, rather than reconstructing the sampled waveform either by a suitable interpolation or an analog filter. (This was actually a serious problem in digital audio level metering, in the days before cheap DSP). – Brian Drummond Feb 14 '18 at 20:19
• This is the correct answer. Taking the data sampled at 200kHz and running a sinc interpolation (oversampling) on it will reconstruct the original 50k signal perfectly. What you see on screen only indicates that the way we visually interpret things in our brains makes it hard to see. The low frequency component you are seeing is due to the 50k and 200k not being exact. If they come from different oscillators, maybe you get 50.01kHz and 199.99kHz sampling, which will create this kind of graphical illusion of a "beat frequency" due to sampling points occurring at different spots on the waveform. – peufeu Feb 14 '18 at 20:20
• And funnily enough, a sinc interpolation is also known as Whitaker's function : it's also the impulse response of a "perfect" low pass filter. – Brian Drummond Feb 14 '18 at 20:20
• I understand exactly what you mean and thanks a lot. I will have a look into the sinc interpolation. Thanks again. – smith1993 Feb 14 '18 at 20:22

You need at least display 2 pixels per sample to prevent aliasing and more to reduce intepolation error to some defined error limit. Shannon's law.

I measured you have 1000 datapoints in 579 image pixels instead of 2000 to 3000 Pixels. Thus a display aliasing frequency results.

• I will alter my code just now and see how it goes. I have covered Shannon's law but would never have thought to relate it to this. Thanks a lot. – smith1993 Feb 14 '18 at 19:57
• Thus the display is causing the aliasing? – analogsystemsrf Feb 15 '18 at 5:20

It’s your screen resolution that is giving you the impression the the signal is aliased. Try focussing in and taking a closer look. My estimate is that this is a storm in a tea cup. Sure there will be artefacts that look like aliasing but it’s just how your screen is handling things. If necessary use a simulator and get an alternative view of things.

• Do you mean the sample sizes? – smith1993 Feb 14 '18 at 19:35
• no he means horizontal resolution – Sunnyskyguy EE75 Feb 14 '18 at 19:36