# Should I sample at twice the bandwidth or twice the highest frequency?

I am confused about what rate I should sample at. I've heard 2 different ways:
1) Sample at twice the highest frequency
2) Sample at twice the bandwidth

If I have a signal composed of just cosine, such as:
$$x(t) = \cos(4 \pi t) + \cos(2 \pi t) + \cos(1 \pi t)$$
What is the correct minimum sampling rate?

• Your $x(t)$ does not depend on $t$? – AlexTP Jul 8 '19 at 20:57
• @AlexTP Good call, I updated the problem. – Tyler H Jul 8 '19 at 21:01

Well, according to Nyquist-Shannon theorem you should sample at a rate which is at least twice the highest frequency you want to capture. This is also referred to as the sampling theorem because it "forms the basis" for sampling.

Now regarding your specific question, I have to say that cos(4*pi) (along with the rest of the components) is just a number which is equivalent to a DC signal. In case you imply cos(2 * pi * 4 * n/fs) (the same for the rest of the components), where n is the sample index (constantly increasing) and fs is the sampling frequency, you should sample at twice the highest frequency (which in this case is 4), which is 8.

As you might be able to say, this would produce a result (just for the first component, but similar for the rest) cos(n * pi), which has a period of 2..., which in turn means that you would get precisely two samples per period. Now in the case you happen to sample at the zero cross, all samples would end up being zero (just for this highest frequency).

I strongly suggest you have a look at some academic literature regarding sampling. I would suggest Proakis' & Manolakis' Digital Signal Processing - Principles, Algorithms and Applications and Orfanidis' Introduction to Signal Processing

• "At least" or "greater than"? – Cedron Dawg Jul 8 '19 at 21:40
• @CedronDawg greater than or equal to. And I think this issue is unnecessarily overstated, as it's only relevant for special case of sinusoidal signals and in practice the difference between at least and greater than is an unobservable quantity existing only in the illusion of infinite precision continuous variable math realm ;-). Practically we already put relaxation band guards as brickwall lowpass filters (that has zero transition bands) cannot be practically realized. – Fat32 Jul 8 '19 at 21:49
• @Fat32 No disagreement. If you're talking practical, your design should be such that this is a non-issue. If you're talking theoretical, the location of the exact boundary is the issue. I think the OP meant the latter. The sine wave at the Nyquist frequency is the counter example that proves this Shannon quote from the Wiki article: "If a function x(t) contains no frequencies higher than B hertz, it is completely determined by giving its ordinates at a series of points spaced 1/(2B) seconds apart." false. Or am I misunderstanding something? – Cedron Dawg Jul 8 '19 at 22:08
• @CedronDawg just overstated... Neither theoretically nor practically that's important. If there is an impulse (or nonzero content) at the Nyquist frequency, then there should not be :-) – Fat32 Jul 8 '19 at 22:31

You've got your answer but let me summarize a bit about your confusion. We can classify signals as being baseband (aka lowpass) or bandpass.

The basic form of Nyquist-Shannon sampling theorem involves bandlimited baseband real signals and says that :

A real, bandlimited to $$W$$ (Hz), continuous-time signal $$x_c(t)$$ can be exactly and uniquely recovered from its samples $$x[n] = x_c(nT_s)$$ taken at a rate $$F_s$$ (Hz) greater or equal to twice its bandwidth; i.e., $$F_s = \frac{1}{T_s} \geq 2 W .$$

Here, bandwidth of the signal and its highest frequency are the same and $$W$$.

A generalization of the baseband sampling theorem is the bandpass sampling theorem which is slightly more involved, nevertheless, the minimum sampling frequency $$F_s$$ is again larger or equal to the twice the bandwidth of the signal, where the bandwidth is described by the nonzero speactral interval (assuming a simple domain) in the positive frequencies alone, for a real signal. Here there's no such thing as highest frequency, but only the bandwidth.

In your question, your signal's bandwidth is $$2$$ Hz and therefore the minimum allowed sampling rate is greater than $$4$$ Hz. Note that for purely sinusoidal signals samlping at the exact twice bandwidth is problematic and shall be avoided. So eventhough it's said minimum $$4$$ Hz, it's never exactly equal to $$4$$ Hz.

Depends on how long you sample.

If you sample for any duration shorter than infinite, then you must sample at a rate higher than twice the bandwidth or twice the highest frequency for a contiguous spectrum baseband signal.

HIGHER

Also note that a non-zero amplitude infinitely long sinusoid at exactly half the sample rate would have infinite energy, e.g. more than exists in the entire universe.