# Slow sampling of signal and averaging over n periods

Can one in theory achieve as high accuracy as needed by sampling a sinusoidal signal over n Periods? Is there a formula that connects the signal frequency (f), sampling frequency (fs), periods (P) and accuracy (Acc) or can someone explain how accuracy rise with number of periods? Let's say I want to know the signals amplitude with an error of less than 0.1%.

Lets say I want to sample a signal with a sampling frequency exactly four times that of the signal frequency. Let's say the first sample hit the sinusoidal signal at it's peak, the second at a zero-crossing, the third at it's negative peak and the fourth at a zero-crossing. This average will yield (1 + 0 + abs(-1) + 0)/4 = 1/2. Averaging over n periods would not change this average value in theory. Let's say the first value hits 45 degrees off the peak and the next 3 samples follows with 90 degree phase difference. The average would now be: (0,71 + abs(-0,71) + abs(-0,71) + 0,71)/4 = 0,71. Averaging over n periods would not change this average value either.

But I have been thinking.

If one introduces a small phase shift of let's say 1 degree per period based on the difference between the signal frequency and the sampling frequency, one could over 360 periods have sampled along the "whole" sinus with samples at 360 different points on a sinusoidal signal. This of course assumes the signal is periodically (and it is in this case). This would give a pretty good estimate of the sinusoidal signals amplitude, but how much is the error here? Is this something that can be calculated easily with some sort of formula or do I have to use MATLAB?

And what happens in "real" situations when the sampling frequency can't be exactly 1 degree off per period, but maybe 0,9384283437 and we have to sample e.g., 324986234 (just a big number to prove the point that an unrealistic number of periods have to be sampled) periods to be able to sample an integer number of periods. I understand that here there will be a trade-off between needed accuracy and number of periods needed to be sampled, but how can I calculate this?

If what I have written above makes sense and is correct, it seems doable to obtain the wanted accuracy by adjusting the phase shift and number of periods to sample over.

Other: I can understand how some would think of this long text as more of an explanation or help to calculate different things. And this is mostly true as I have no experience or academic background in digital signal processing and therefor need to get confirmation on my idea, thought and understanding of the subject. Things I ask here are things I have not found the answers to by any text book or by googling, even though they for sure are available a lot of places, none of them have been able to completely show me or make me understand this topic and I am therefor asking by writing this text above. Hopefully others may benefit from this questions and the answers provided. Thanks! =)

• This might help: en.wikipedia.org/wiki/Aliasing#Sampling_sinusoidal_functions To talk about accuracy I think you need to have some kind of error term in there. Jun 11, 2013 at 0:30
• This is called "equivalent-time sampling" when used in oscilloscopes cp.literature.agilent.com/litweb/pdf/5989-8794EN.pdf Jun 11, 2013 at 14:27
• @endolith: Thank you for the terminology! Do you know if it has any other names? (This would help my googling a lot!). Jun 11, 2013 at 16:22
• @Phataas: That's the only name I know of. I don't think it's the same thing as en.wikipedia.org/wiki/Undersampling, but that might be good to look at too Jun 11, 2013 at 17:12

Accuracy is independent of the sampling frequency and frequency, as long as your signals frequency is smaller than half of the sampling frequency. In the noiseless case its also independent of the number of periods.

Your calculation of the mean of the sample values has no connection to calculating the amplitude of the signal. To calculate the amplitude one would normaly use a DFT.

Here is a sample Matlab code using your examples, and showing that both give the same amplitude:

x1 = abs(fft(cos([0:pi/2:3/2*pi])));
x2 = abs(fft(cos([0:pi/2:3/2*pi]+pi/4)));


Both signals show the same amplitude (which must be scaled properly to get the exact value).

In the case of noise, using multiple periods is kind of averaging, where the following rule holds (for uncorrelated noise): doubling the number of averages (periods) gives 3 dB more SNR (signal to noise ratio).