Bandwidth of Square Wave

crutschow

Joined Mar 14, 2008
34,470
A perfect (ideal square-wave) has zero rise and fall time. To achieve that would require infinite bandwidth. Real square-waves have a finite rise and fall time of course and the bandwidth is related to that time. This required bandwidth is approximately 0.35 / Tr where Tr is the rise-time (or fall-time) measured between the 10% to 90% of the square-wave amplitude.
 

MrAl

Joined Jun 17, 2014
11,496
Hi,

The 0.35 figure often given could be incorrect. For example, the flat response rise time of a 50% duty cycle clock pulse spanning 0 to 1 is related to its fundamental frequency by:
N=3, A=0.33
N=5, A=0.37
N=7, A=0.39
N=9, A=0.40
N=77, A=0.44
where N is the harmonic number and A is the factor usually quoted as 0.34 or 0.35,

and as we get higher A gets higher, up to around 0.446 near N=1999 (didnt go any higher than that yet).
These are not estimates but exact figures for the rise time considered to be 10 percent to 90 percent from the mean of either the 0 or 1 state.

Even more significant is that since the bandwidth is often quoted as the frequency where the response drops to -3db of its maximum value, that means we'd have to multiply the result by 1.4142 to get the required (non flat) bandwidth.

So for example if we have a 1Hz clock signal (keeping this simple) and we want a (flat bandwidth) rise time of 0.044444 seconds (for simple division) we would require a bandwidth of 9Hz (0.40/0.044444=9.0), but since bandwidth is usually specified as 3db down, we'd really need a bandwidth of around 13Hz. That could make a big difference in some applications.

I'll look at this more too if i can soon, and all comments welcome.
 

MrChips

Joined Oct 2, 2009
30,824
You can run a simple test, real or simulated.

Feed a square wave signal into a low pass filter. Examine the rise and fall times of the output as you alter the cutoff frequency of the filter.
 

MrAl

Joined Jun 17, 2014
11,496
Hi MrChips,

Yeah that would tell us more i think. I think the 0.35 calculation comes in slightly too shy, but i'll have to try this soon.

What i did do originally was simply calculate the sum of the sines using the generator function:
Y=4*sin((2*k-1)*w*t)/((2*k-1)*pi)
for k=1 to floor(N/2)+1

and then summed all the terms and made the whole thing positive (like a clock pulse) with:
y=(sum(all Y)+1)/2

then solved for t1 when y=0.1 and t2 when y=0.9, then subtracted t2-t1 to get the rise time.

So what this should mean is that if we wanted to construct a wave using sines then we'd have to include up to at least a sine that met the rise time criterion of A/tr, and this A came out higher than expected.
At least that part should be accurate, but i am thinking that maybe there is a difference for using a low pass filter (like a previously existing device would have as an approximation) and actually generating a wave with a given rise time spec.

I had to do some other stuff on the car today so didnt get to finish looking at this yet. It did turn out to be pretty interesting.
 

studiot

Joined Nov 9, 2007
4,998
If you built your square wave from an infinite sine series you would also require an infinite amplitude capacity.

What would you do about the Gibbs Phenomenon?
 

MrAl

Joined Jun 17, 2014
11,496
Here's an explanation of where the factor of .35 can from in the rise-time to bandwidth equation.

Hi,

Remember that we were really talking about *generation* of a square wave, not attenuation. I believe that the 0.35 factor may be somewhat applicable when we talk about a device that acts like or incorporates a filter like behavior that limits the bandwidth. In other words, it acts like a low pass filter that limits the rise time.
In generating the signal though, it looks like the factor may actually have to be doubled worst case or at least raised up to 0.45 for harmonics greater than some low limit like 7. I posted numbers for this previously and i believe he (the OP) was talking about generation not attenuation, but i think looking at both cases is even better :)

Also, the linked article as of this writing 08/20/14, 8:50am EDT is in need of serious editing.
 

MrChips

Joined Oct 2, 2009
30,824
I think the OP was just asking a general question about the bandwidth of a square wave.

What we are pointing out is that it depends on one's definition of a square wave.
If the rise and fall times are zero, then the bandwidth is infinite.

If you assume finite rise and fall times then you can accept some finite limits to the bandwidth.
 
Top