# Does "keying on" a sine wave at a zero-crossing reduce its bandwidth?

I understand that a pure sine wave of infinite duration occupies no bandwidth, i.e. it is only the modulation of a carrier that gives it sidebands. Does the exact timing of a sudden modulation make any difference?

For simple on-off keying of a signal, it looks like https://dsp.stackexchange.com/a/24604/18819 is giving an equation to determine the relative power away from a carrier:

The spectrum of your windowed sinusoid is just a shifted sinc function

…and the magnitude of this function is based only on the length of the windowed signal. In all discussions I've seen (e.g. CW bandwidth described) they discuss things like keying envelopes and such to reduce the splattering of significant power away from the intended carrier frequency. They don't discuss the precise timing of the envelope.

I'm wondering: does it make any difference at which phase of its cycle I "key" a sine wave on or off?

The Wikipedia article on Zero-crossing circuitry explains:

…the switching device will "wait" to switch on until the output AC wave reaches its next zero point. This is useful when sudden turn-on in the middle of a sine-wave half cycle could cause undesirable effects like high frequency spikes for which the circuit or the environment is not expected to handle gracefully

Is this just a practical concern (i.e. non-ideal components in a real-world circuit) or does the spectrum actually change if I make a "chopped-off sinewave" from 0º to 360º, vs. a section from 90º to 450º? What about from 0º to 180º vs. 90º to 270º?! [Update: to be clearer, maybe I'm really meaning in each case e.g. "from 90º to (360n+270)º" for some relatively large n so that the signal lasts for a bit between start/end.]

In both of those pairings, the signal which starts and ends at 0 magnitude certainly seems "cleaner" than a signal suddenly starting like in the last example at +1 and ending suddenly at -1. But can this difference be demonstrated mathematically? Each pair starts/ends the sine wave "instantaneously" and they both keep it running for the same duration, so are they equivalent as far as "splatter"?

• Communication system theory tells that smooth transitions require less bandwidth and concentrate the enery on their main lobe, while sharp transitions require more high frequencies and larger bandwidths. Also the switched capacitors will potentially create spike currents if the imposed voltages do not match with the initial condition voltages on them. But this second thing is not related with the first. May 25 '16 at 21:47
• The bandwidth will still be infinite, but the sidelobes will be smaller than if you chopped the sine wave arbitrarily. A similar concept applies in MSK, where the frequency transitions are made to happen at a time when both sine waves are zero-crossing.
– MBaz
May 25 '16 at 23:45

The difference between a rectangular window on one cycle of a sinewave (begins and ends on 0) and one cycle of a cosine wave (begins and ends on -1 or 1), both strictly real, is in how the two complex conjugate images in each half of a FT interact. For the sine wave, the conjugate images are 100% "imaginary", thus of opposite signs, thus some of Sinc roll off cancels out. For the cosine wave, both conjugate mirror images in the FT are strictly real, thus of the same sign; thus the sidebands interfere constructively and generate more sideband energy or "key clicks".

Rectangular windows on both waveforms generate sidebands, but especially for short waveforms (only a few cycles) windowing edges at or near the zero crossings can generate lower sideband energy due to possible greater conjugate image cancellation interference in the transformed spectrum.

• Thanks for concisely rephrasing my question! To be honest I don't fully understand your answer (what's a "conjugate image"?) but I can follow it enough to learn more [and ask more: dsp.stackexchange.com/questions/31087/… myself. I think I am seeing some the differences you're talking about between the [-6,+6] graph of a FT'ed piecewise cos vs. if I change the input to use "sin" in its place. May 26 '16 at 19:40

It is instructive to have a look at the expression for the spectrum of a truncated sine wave to see how the choice of the window length affects the decay of the spectrum. Let's define a windowed sinusoid $s(t)$:

$$s(t)=\sin(2\pi f_0t)\cdot\text{rect}(t,T)=\begin{cases}\sin(2\pi f_0t),&-T/2<t<T/2\\0,& \text{otherwise}\end{cases}\tag{1}$$

The Fourier transform of $s(t)$ is the convolution of the transforms of the sinusoid and the rectangular window:

\begin{align}S(f)&=\frac{1}{2j}\left[\delta(f-f_0)-\delta(f+f_0)\right]\star T\text{sinc}(Tf)\\&=\frac{T}{2j}\left[\text{sinc}(T(f-f_0))-\text{sinc}(T(f+f_0))\right]\tag{2}\end{align}

With $\text{sinc}(x)=\sin(\pi x)/(\pi x)$ we get from $(2)$

\begin{align}S(t)&=\frac{T}{2 j}\left[\frac{\sin(\pi T(f-f_0))}{\pi T(f-f_0)}-\frac{\sin(\pi T(f+f_0))}{\pi T(f+f_0)}\right]\\&=\frac{1}{2\pi j}\frac{(f+f_0)\sin(\pi T(f-f_0))-(f-f_0)\sin(\pi T(f+f_0))}{f^2-f_0^2}\\=&\frac{1}{2\pi j(f^2-f_0^2)}\Big\{f\big[\sin(\pi T(f-f_0))-\sin(\pi T(f+f_0))\big]+f_0\big[\sin(\pi T(f-f_0))+\sin(\pi T(f+f_0))\big]\Big\}\tag{3}\end{align}

The spectrum $(3)$ decays as $\propto 1/f$ because we have $f^2$ in the denominator and $f$ in the first term of the numerator. If the window length $T$ is chosen such that an integer number of periods of the sinusoid are inside the window, then the limits of the window will be exactly at zero crossings of the sinusoid. This condition is equivalent to $Tf_0=n,\;n\in\mathbb{Z}$. With this condition the first term in the numerator of $(3)$ vanishes because the arguments of the two sinusoids differ by $2\pi n$, and, consequently, both sinusoids are identical. As a consequence, in that case the $f$ in the numerator disappears and the spectrum $S(f)$ will decay as $\propto 1/f^2$ instead of $\propto 1/f$.

In sum, if the windowing does not cause any discontinuities (i.e., the window limits occur at zero crossings of the sinusoid), the spectrum of the windowed sinusoid will decay as $\propto 1/f^2$. This is generally the case for continuous functions. Such functions can of course decay even faster, but only if they also have continuous derivatives, which is not the case for a windowed sinusoid. If the windowed sinusoid is discontinuous, i.e., the window limits do not occur at zero crossings, then the corresponding spectrum only decays as $\propto 1/f$.