# Calculating SNR of a complex-valued signal correctly

I have an array of complex-valued data. I would like to modify the array by injecting an artificial signal at a chosen Signal to Noise ratio.

I have seen the signal to noise ratio for complex-valued data calculated as:

$$SNR = \frac{}{}$$

Right now, I am assuming my data is all noise and calculating the denominator by taking the mean of the real part of the data multiplied by its imaginary part.

One problem I have with this equation is that it would imply that if I added a constant real signal to all the data (for example just adding $$0.5 + 0j$$) the SNR of the added signal would be zero since its imaginary part is zero and hence $$SS^*$$ is zero. Obviously this doesn't make sense. So how do I correctly calculate the SNR of an added signal? I'm looking for a way of determining $$a$$ and $$b$$ in a complex number $$a+ib$$ added to all the data, such that the resulting data has an artificial signal of $$SNR = X$$ embedded in it.

• $\langle S, S^*\rangle\ne0$ in every case but $S$ being all zeros. Not quite sure why you think that would be the case? So, probably, you've got the formula for the inner product wrong. – Marcus Müller Jul 31 '20 at 7:04

## 1 Answer

Just simply compute the variance of the signal and the variance of the noise. (And adjust the noise for sampling factor if necessary, see below). Variance is not a complex result and the complex conjugate is used in the computation so should be invariant to real or imaginary content; 5+j0 and 0+j5 have the same variance; if the entire signal rotated in phase, how would that have any effect on the power?

Note computing SNR when you are creating a signal is trivial as you can completely separate the signal and noise components, scale appropriately and add. Measuring SNR on a combined signal is a little more challenging and for this purpose I recommend using correlation to measure SNR given the direct relationship between rho (correlation coefficient) and SNR.

Also pay attention to the spectral density of the noise to set the SNR properly such that it is scaled to be just the portion of the noise that is in the bandwidth of the signal.