When rectifying a signal by squaring it, is it necessary to upsample by a factor of 2?
Why is this?
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.
Sign up to join this communityWhen rectifying a signal by squaring it, is it necessary to upsample by a factor of 2?
Why is this?
The only reason I can think of may be to preserve the frequencies over which original signal had spectrum (before squaring). When you square a signal $x[n]$, whose spectrum $X(e^{j\omega})$ extends from $-\omega_0 \le \omega \le \omega_0$, you are multiplying by itself. So in frequency domain, the effect is to (periodically) convolve $X(e^{j\omega})$ by itself. $$ S(e^{j\omega}) = \int_0^{2\pi} X(e^{j\theta})X(e^{j(\omega - \theta)})d\theta $$ The convolution will result in $S(e^{j\omega})$ non-zero over $-2\omega_0 \le \omega \le 2\omega_0$. If you had upsampled before squaring, the spectrum before squaring would have been non-zero only from $-\omega_0/2 \le \omega \le \omega_0/2$. So after squaring (convolution in frequency domain), its spectrum is still $-\omega_0 \le \omega \le \omega_0$.
I think the accepted answer is not quite strong enough to state the real problem: If you don't up-sample you run the risk of significant aliasing.
Let's look at a simple example: sample rate of 25.6 kHz and a strong signal component at 11.5kHz. If you just square it you end up with a component at DC (which is representative of the average energy) and another one at 2600 Hz. The one at 2600Hz has NOTHING to do with your original signal. It's simply an aliasing artifact that's a function of the sample rate. If you were to sample this at 25.0 kHz that component would move to 2 kHz.
Any analysis or conclusion drawn from the aliased component would simply be wrong.
So the options are to either up-sample or low-pass filter somewhere below $F_S/4$ before squaring the signal