# Square wave spectrum and knee frequency

There is this rule of thumb to estimate the required bandwidth of a digital signal by its rise time: $$\text{f}_{\text{knee}} = \frac{0.5}{\text{t}_{rise}}$$

This knee frequency is described in "High Speed Digital Design: A Handbook of Black Magic" as the point at which the spectrum of a real signal would show a steep fall off. I simulated this, first with python and then LTspice, and expected that the spectrum would be monotonously decrease above the knee frequency. Both simulations of a 100 MHz square wave showed the following:

The green spectrum has the steepest rise time (10 ps), whilst blue has a lower (100 ps) and red the lowest (1000 ps). One can see that the spectrum of blue shows a steep fall off somewhere around the knee frequency (light blue shows knee frequency), but then rise again (black arrows). I tried different windows types and widths in LTspice. The overall shape remained the same.

Can this be explained mathematically or is this not part of the theory, but an artifact from the FFT?

LTspice circuit

• Your green curve also shows a steep fall-off about 1 decade out from where the blue curve does, just as you would expect from the formula. But this is an empirical rule of thumb, not really an exact formula. Some other source might give $f_{knee}=0.7/t_{rise}$ for example. Or you might need a different constant factor if you use the 20-80 rise-time instead of the 10-90 rise-time, etc. Commented Nov 9, 2019 at 18:04
• with finite risetimes, say T, there will be a NULL in the response at F = 1/T. Why? because that ramp, convolved with a sinusoid of F frequency, will precisely integrate to ZERO. Commented Nov 10, 2019 at 3:26

Your signal has high-frequency content due to the discontinuities in the derivative due to building it as a piecewise linear waveform.

Try turning the problem around.

Make a "realistic" square wave by passing an ideal square wave through a low-pass filter.

Now compare the resulting rise-time with the knee frequency, and see what you get.

The rule of thumb makes the assumption of a practical, realistic, signal, where the risetime is limited by lowpass filtering.

A Spice simulation of a voltage source with a slewrate limit is still too simple, too far from realistic, to give you nice looking FFTs, or to be well described by the rule of thumb. This is because it has discontinuities in slope between the flat tops and bottoms of the pulses, and the straight-line slews between them. The finite length of time between the top and bottom of the transition gives rise to the zeroes, the deep dips between the black arrows, that puzzle you in the spectrum.

Spice's use of the risetime limit is the minimum possible mathematical allowance for the fact that it's a discrete time simulator and doesn't want to handle instantaneous changes, and in some circumstances it's adequate for modelling some limited slewrate effects. It's not there for modelling systems whose bandwidth is limited by the normal rolloff in amplifiers and filters. If you want to model that, you must add some filter components. Pass the voltage source into an RC filter, and analyse that output. Set the source risetime to <10% of the risetime dictated by the RC filter (another rule of thumb) so that the output behaviour is mostly dictated by the RC, and have another go. Note that you'll have to measure the risetime at the output of the RC, we usually use the time between the 10% and 90% levels.

What you see is the rectangular window which in the frequency domain is sin(x)/x

This Window is superposed with your spectrum and gives it an envelope

see my answer here which shows it Why the power line interference harmonics appear gaussian?