Hello,
I have a problem which should be simple but I can't figure out the best solution.
I have a real signal, cos of frequency f + noise of N points :
signal = sqrt(2 * Ps) * cos(2 * pi * f *t);
noise = sqrt(Pn) * randn(1, N);
I consider the SNR on the whole signal Ps/Pn that I also check using
(mean(abs(signal.^2)) - mean(abs(noise.^2))) / mean(abs(noise.^2))
I filter this signal using a simple FFT of nFFT points and consider an extraction in the signal canal. For instance, with f / fs = 1/4, I consider the nFFT / 4 + 1 canal. Plotting the signal spectrum, I ensure the signal is centered in the FFT canal. Then I compute :
The power in the canal : PsCanal = mean(abs(samplesCanalWithSignal.^2)).
The noise level in a random other canal : PnCanal = mean(abs(samplesCanalWithoutSignal.^2))
And compute SNR in the canal : SNRCanal = (PsCanal - PnCanal) / PnCanal.
Now I consider a complex signal. Same time, fe, etc... I only change signal and noise definition in order to have same global powers :
signal = sqrt(Ps) * exp(2i * pi * f *t)
noise = sqrt(Pn / 2) *(randn(1, N) + 1i * randn(1, N))
When I compute the global RSB, I have the exact same RSB than with real signal.
Then I compute the FFT (same nFFT points) and compute SNRCanal = (PsCanal - PnCanal) / PnCanal
Result is the following (compared to real signal test) :
- Same PnCanal
- PsCanal multiplied by 2
- RSBCanal multiplied by 2
Where am I wrong ? I would like to be able to estimate the correct SNR in the FFT canal for real signals... I understand the PSD of the cos is half the one of exp due to positive and negative frequencies, but don't understand why it is not the case for the noise PSD. Do I have to transform something ?
Thank you