# ADC Sampling using a Varying Sample Period

Discussion in 'General Electronics Chat' started by dannybeckett, Apr 7, 2016.

1. ### dannybeckett Thread Starter Active Member

Dec 9, 2009
163
0
Hi Guys,

Just a quick thought experiment. If you're sampling a signal of frequency x, you have to have a sample frequency of 2*x or greater to prevent aliasing errors. My question is this:

If your sampling period is random, but is always twice as fast as the signal you're trying to sample, do you get any sampling errors, or would this be an acceptable method of sampling an analogue signal?

Dan

2. ### GopherT AAC Fanatic!

Nov 23, 2012
6,304
4,027
Are you looking for peak values?, use a peak detector and some method to discharge the captured peak value trapped in the capacitor.
Are you looking for an instantaneous value to digitize an audio signal?
What is the goal?

3. ### dannyf Well-Known Member

Sep 13, 2015
2,196
417
How can the sampling frequency is random and always 2x as fast at the same time?

If you meant "at least twice as fast", it gets easy: think of two sampling system for your signal, one samples at 2x the speed, and another randomly.

The samples are then blended and presented to you. What would you to do to follow shannon? The easiest would be to discard the random sample and use the 2x sampled data.

Done.

4. ### dannybeckett Thread Starter Active Member

Dec 9, 2009
163
0
Hi guys, there's no goal, this is a thought experiment only. I'm not trying to achieve anything here

By "random, but is always twice as fast as the signal you're trying to sample", what I'm trying to say is, if you can somehow guarantee that your sampling rate is at least 2*fsignal, but the sample period is inaccurate, so from sample-to-sample, the sample period changes, will this affect the reading of the analogue signal? My instinct is saying yes, and it's called jitter. Is this right?

5. ### nsaspook AAC Fanatic!

Aug 27, 2009
3,011
2,356
ErnieM likes this.
6. ### GopherT AAC Fanatic!

Nov 23, 2012
6,304
4,027

If the period of the previous wave is going to predict (or be the same) as the next wave, then you can come up with some type of model. However, if there is any randomness to your signal source, then you would have to either predict he future or record the past to know what the period of a signal will be. Do you assume sign wave, square wave etc - sampling at 2x frequency will allow you to measure every zero cross event (one pos to neg and one neg to pos transistion) or each peak but you will not be able to measure the shape of the wave.

If you have no goal, then there is no possible way to answer because there are so many un-defined constraints and too many possible solutions without constraints that this discussion is a waste of time until you do more research to better define your constraints and question.

7. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,436
1,625
I believe this is the same Doc Papoulis I studied under.

8. ### MrAl Distinguished Member

Jun 17, 2014
2,553
515
Hi,

Randomness and noise are probably the most misunderstood concepts in electronics.
Sometimes good, sometimes bad. When it is bad it can be very bad, but when it is good it can be very very good.

In this case it sounds like the signal might be repetitive. If so, then you can use randomness to completely reconstruct the signal with far better resolution than any slow regular sampling can ever achieve. If the signal is not repetitive however then you'd need more samples.
If the signal is repetitive and you dont take steps to reconstruct the signal, then that's not very good because the result will have unwanted harmonics which can be low enough to make the readings look unstable.

There are examples of using randomness in situations where we'd never expect to see them. One good example is in calculating the value of pi (3.14159...). pi is not a random number of course, but we can calculate it using properties of randomness.

9. ### crutschow Expert

Mar 14, 2008
13,482
3,368
Generally any jitter in the sample period will cause distortion in the recovered signal unless you know what the jitter is and can take that into account.

10. ### dl324 Distinguished Member

Mar 30, 2015
3,377
651
Only for special cases. The signal needs to be periodic and you need to make assumptions about the type of waveform being sampled.

In the following waveforms, you have little hope of reconstructing the actual waveform if you sampled at 2X and didn't know what you were sampling. If you sample at the red vertical bars, how could you reconstruct the actual waveforms? The sine and triangle waves give the same sampled data.

EDIT: As pointed out in a later post. The red sampling points only represent 2X oversampling for the sine wave. Harmonics need to be considered for the others.

Sampling theory states that sampling frequency must be greater than 2X the highest frequency being measured.

Last edited: Apr 8, 2016
11. ### AnalogKid Distinguished Member

Aug 1, 2013
4,686
1,297
No. To recover the signal with exactly 2x samples requires a *very* high performance lowpass filter. Once you have that, samples coming in at greater than 2x are just extra samples. Think about it. If your recovery system is working perfectly with 2x samples, and you suddenly change the incoming data to 10x samples of the same input waveform, the only thing that will happen is that the output ripple will decrease. Assuming there is output ripple because the lowpass filter does not have an infinite number of poles.

BUT -

Remember that the 2x sampling limit applies to 2 x the highest frequency of interest, and the recovery of that frequency will be a sine wave because by definition the highest freq of interest is a sine wave. Always. If you sample a 1 kHz square wave at 2 kHz, the recovered output will be a 1 kHz sine wave.

ak

12. ### dl324 Distinguished Member

Mar 30, 2015
3,377
651
Sampling Theory states that the sampling frequency should be at least 2X the highest frequency to be sampled. That means 3X or more; 2X is not sufficient.

13. ### AnalogKid Distinguished Member

Aug 1, 2013
4,686
1,297
True, 2x is the limit, not a practical value. At 2x you lose all amplitude and phase information.

ak

14. ### MrAl Distinguished Member

Jun 17, 2014
2,553
515
Hi there,

Jitter isnt the same as random however. Jitter implies that we have just a small random portion coupled with a large constant portion. Random really means that the entire portion is random. For a sine wave with period of 1 second, this would mean sometimes we would measure at 0.1 second, sometimes at 0.5 seconds, sometimes at 0.3 seconds, sometimes at 0.9 seconds, etc. There would be no predicting where it would sample next, even within a small band.

I agree however that jitter or something that is like that will cause too much fluctuation in the measurement and may make a sine wave of 1 Hz look like a sine wave of 1Hz plus some other higher and lower frequencies. I'd hate to have to recover the signal from that mess
Well ok, i guess if the jitter itself was truly random (within that small band) then we could perhaps average the time and recover the signal anyway. That probably falls under the category of multi dimensional filtering.

15. ### crutschow Expert

Mar 14, 2008
13,482
3,368
If the sample period was pseudo-random (predictable from a known pseudo-random generating function) then you could reconstruct the signal using the same pseudo-random function.
But that's a very specialized situation.

16. ### AnalogKid Distinguished Member

Aug 1, 2013
4,686
1,297
In the context of sampled data systems, jitter is a sample that is out of its time position. If a 1.0000000000000 kHz sampling clock is absolutely perfect, with no frequency or phase noise, then each sample is 1.0000000000000 ms apart. If the recovery system clock is not so precise, and one particular clock edge occurs 1.0000001 ms after the previous edge, that recovery clock jitter will introduce distortion into the recovered waveform. This frequency-domain distortion is the digital world's pseudo-equivalent of an analog tape recorder's wow and flutter.

ak

17. ### ErnieM AAC Fanatic!

Apr 24, 2011
7,436
1,625
You have a serious error here in that you have mistaken the fundamental frequency with the bandwidth.

Only one of these waveforms has a bandwidth equal to the fundamental frequency. The others have a much higher bandwidth, actually they approach or equal infinity.

18. ### crutschow Expert

Mar 14, 2008
13,482
3,368
Yes.
That brings up the point that you need an anti-alias filter at the input to the A/D to limit the bandwidth of the signal to no more that 1/2 the sample frequency.
(Any frequencies above that must be rolled off to no more than 1LSB in amplitude to avoid generating aliased noise in the sampled signal).
That is why the sample frequency is typically much higher than twice the highest signal frequency, to minimize the roll-off requirements of this anti-alias filter.

19. ### dl324 Distinguished Member

Mar 30, 2015
3,377
651
Thanks for point that out. For practical purposes, it's probably acceptable to only consider the 5th or 7th harmonic of the square wave.