# Filter before or after multiplication of two signals?

I have two signals and want to multiply them, e.g. voltage and current are multiplied to get power. The result (e.g. power) shall be a filtered result, e.g. to see the average.

Is it better to filter (digitally) each signal separately before the multiplication or to filter after the multiplication?

Intuitively, I would have said that filtering before the multiplication is better for three reasons:

1. Less numerical problems
2. Noise of both signals is added by the multiplication, thus filtering before multiplication improves SNR
3. Multiplication generates modulation products and if you filter out a frequency you do not want to see anyway it also does not cause modulation products.

Am I on the right track here or is there something I am overlooking?

Edit 1: To answer the question of typical signal spectra: Think of a laboratory grade measurement device like a multimeter. It acquires two signals which can be any signal shape (in time domain) but are band-limited by the input circuitry to avoid anti-aliasing. Noise is typically white noise with a bit of 1/f noise added. SNR is usually 10's of dB.

• If your SNR is high enough, it will not matter the order in which you do it. – Ben Jul 11 '19 at 17:17
• Do not hesitate to validate an answer, as appropriate – Laurent Duval Dec 20 '19 at 16:48

A personal rule: in general, it can be better to perform non-linear operations before linear ones. One reason behind that is that a lot of practical concerns are related to outliers or suspect behavior, which can easily be smoothed out (and become indistinct from other signals) by linear filters.

Let me reformulate. If $$f_i$$ denote filters, and $$s_i$$ signals, should one do $$f_0 \ast(s_1 .s_2)$$ or $$(f_1 \ast s_1)(f_2 \ast s_2)$$? Without a better knowledge on the spectra of the signal, the nature of the noise and the numerically objective, I have no definite answer. The second one is apparently more flexible, become you can paly on two filters.

If the result is some kind of average, I would filer the product, as averaging is filtering, and it commutes with filtering. Thus, you have more chance to preserve the average after filtering the product, if the noise is low. Since two signals like $$+1,-1,+1,-1\ldots$$. Any even-length avering will turn them into $$0$$, while their product is flat with average 1.

I cannot see why you will have less numerical problems.
Noise is added "logarithmically", but the same happens to signals. But yes, modulation can be troublesome, but two cosine with zero mean will be multiplied into a non-zero mean signal, and this is what you want to measure.

In some cases though, to preserve contrast in image, homomorphic filtering convert a product into a sum to filter separately the two components (cf. "The second one is apparently more flexible"). Finally, you can use non-linear filters on the product as well, in case of complicated noises. A related question on the ordre of operations can be found in Is convolution distributive over multiplication?

• Your reformulation of the question is exactly right. For typical spectra see my edit. The objective of filtering is to extract the average component which is slowly changing over time – JLo Jul 12 '19 at 6:32

In general you will need to multiply first and then low pass filter. You also have to make sure that your sample rate is high enough so the multiply doesn't create aliasing.

Let's look at a simple example: feed a 1kHz signal into a loudspeaker and measure current and voltage to determine the average (thermal) power with maybe a 100ms time constant. The power is highly dependent on the phase between the current and the voltage. Multiplying creates components at 2kHz and 0 Hz where the component at 0Hz represents the average power that can be extracted with low pass filtering.

If you low pass filter first, you remove the 1 kHz from both current and voltage before multiplying so the average power will always come back very small or zero (regardless of that the actual power is)