DSPRelated.com
Forums

Sampling Rate of Square Wave

Started by vinbng October 5, 2006
I was once asked over a telephonic interview what the sampling rate of a
square wave..  What would be the best answer for this.


Hi,

I'd answer that it is impossible to sample a square wave perfectly,
since the harmonics spread out to infinity. Nevertheless, one could
define a suitable border for the harmonic frequencies to include,
low-pass-filter the square signal from this upper border, then sample
with at least 2.56 this frequency to avoid aliasing and get a sampled
version of a more or less rounded-shape-square wave. The more
frequencies you include the closer you get the perfect infinitely steep
transitions of the rectangular form.

By second thought, if you don't need a sampled version of an "analog
square wave" (I wonder if this exists in reality) but have to sample a
already digital signal with defined clock frequency you just sample at
this clocks frequency and get a zero or one every time. From this you
can redefine the digital signal exactly.

But I guess they wanted you to answer the first version. Did you get
the job?

Would I?  :-)

Greetings

stereo

vinbng wrote:
> I was once asked over a telephonic interview what the sampling rate of a > square wave.. What would be the best answer for this.
stereo wrote:
> I'd answer that it is impossible to sample a square wave perfectly, > since the harmonics spread out to infinity. Nevertheless, one could
Obviously this is a problem if the signal is not bandlimited, and also unknown. But here, the signal is known to be a square wave !! Let's assume we don't know its fundamental frequency, amplitude, and phase (relative to some point t0), and that we do know its duty-cycle is 50%. Consider the following: If we are allowed to perform/gather an arbitrarily large number of samples (N -> inf), then it's possible to estimate the unknown parameters (frequency, amplitude, phase), with very high accuracy, even if we sample below the Nyquist rate of the fundamental frequency (!!), when we do NOT use an anti-aliasing filter. The more samples we're allowed to take, the higher the accuracy of estimation.
I like your answer. Smart.