1
$\begingroup$

When rectifying a signal by squaring it, is it necessary to upsample by a factor of 2?

Why is this?

$\endgroup$
1
  • $\begingroup$ As a complement to jithin's fine answer: When processing a signal, the sampling theorem needs to be satisfied at every step, including the final result, or aliasing will occur. $\endgroup$
    – MBaz
    Mar 27, 2020 at 16:19

2 Answers 2

2
$\begingroup$

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$.

$\endgroup$
1
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ Conversely, if you have a signal that is known to have no significant energy above 1/4 the sampling rate, then you could square it safely, knowing that the result would have no significant energy above 1/2 the sampling rate. $\endgroup$
    – TimWescott
    Mar 27, 2020 at 19:08
  • $\begingroup$ Hence my recommendation of a lowpass filter at Fs/4 I'm assuming that the sampling rate was chose based on the actual contents of the signal $\endgroup$
    – Hilmar
    Mar 28, 2020 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.