Sampling frequency and square waves

In summary: You can read more about it on Wikipedia or elsewhere online. In summary, if you want to accurately capture the characteristics of a square wave, you need to sample it at least twice the highest harmonic frequency.
  • #1
Deathfish
86
0

Homework Statement



Lets say I have a square wave of 10Hz. I want a good sampling frequency or the Nyquist rate (minimum) to accurately capture its characteristics without aliasing. Is it enough to use 10Hz x 2 as nyquist rate, or must I break it down into harmonic frequencies? and use maximum harmonic frequency as the sampling rate?

What if I do not use the square wave function, but instead sum together harmonic frequencies? Do i still use Fmax as 10 Hz, or use the highest harmonic frequency as Fmax?

Homework Equations



sin 2πft + 1/3 sin 2π3ft + 1/5 sin 2π5ft +1/7 sin 2π7ft ...

am asking that if i use eg. 4 harmonics, must I use Fmax = 70Hz ?
or if i sum together 20 harmonics and use Fmax = 10Hz can i still preserve the signal.
(not necessarily using 2 x Fmax - nicer shape plot may use 10 x Fmax.)

The Attempt at a Solution



something to do with too few sampling points not being able to reproduce shape of square waves and instead getting it wrong. But not sure whether this affects the frequency information extracted during plotting. not sure how summing together harmonics affects result.
 
Physics news on Phys.org
  • #2
I'm afraid I don't think that your question is well specified. The answer depends very much on what information you have and what information you need to know.

For example, if you already know you've got a 10Hz square wave, the only question remaining is when the discontinuities occur (i.e. the phase, if that's a well defined term for a square wave). Off the top of my head, I can think of two ways to do that.

If you know you've got a 10Hz wave, but don't know the form then you need a different strategy.

If you don't know the frequency but do know that it's a square wave then you need a different strategy; if you have an idea of the frequency (<100Hz, for example), there's a different strategy again.

If you can specify your question more precisely, the answer might come to you and/or we might be able to help more.
 
  • #3
In theory a square wave is made up of an infinite number of odd harmonics. So the issue is determining how many you need to meet your definition of "accurately capture its characteristics".

http://en.wikipedia.org/wiki/Square_wave

For a reasonable approximation to the square-wave shape, at least the fundamental and third harmonic need to be present, with the fifth harmonic being desirable

You can probably find (or plot using a spreadsheet) a picture of what a square wave looks like when built from only "n" harmonic sine waves.

If the rise time of the square wave is known and important it should be possible to calculate how the accurately the rise time of a reconstruction built from n harmonics matches. At least over say 10-90% of the amplitude. You could probably also calculate the magnitude of any under/overshoot. Been 35 years since I did anything like that.

You will need to sample at at least twice the required highest harmonic.

Sampling theory is a subject in it's own right.
 

1. What is sampling frequency?

Sampling frequency is the number of samples per second that are taken from a continuous signal to create a digital representation of that signal. It is typically measured in Hertz (Hz).

2. How does sampling frequency affect square waves?

The sampling frequency determines the number of points used to represent the square wave. A higher sampling frequency will result in a more accurate representation of the square wave, while a lower sampling frequency may lead to distortion or loss of information.

3. What is the Nyquist-Shannon sampling theorem?

The Nyquist-Shannon sampling theorem states that a signal must be sampled at a rate at least twice its highest frequency component in order to accurately reconstruct the original signal. This applies to square waves as well, as they are composed of multiple frequency components.

4. Can a square wave be accurately represented with a finite sampling frequency?

Yes, as long as the sampling frequency follows the Nyquist-Shannon sampling theorem. However, as the number of frequency components in a square wave is infinite, a perfect representation of a square wave is not possible with a finite sampling frequency.

5. How does undersampling affect square waves?

Undersampling, or sampling at a frequency lower than the Nyquist rate, can result in aliasing and distortion of the square wave. This is because the higher frequency components of the wave are not being accurately captured, leading to a distorted representation.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Electrical Engineering
Replies
4
Views
833
  • Engineering and Comp Sci Homework Help
Replies
2
Views
922
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
Back
Top