DSPRelated.com
Forums

PSD noise floor vs SNR

Started by Peter Mairhofer June 21, 2014
Hi,

Just confused ... I created PSD plots (with MATLAB spectrum.welch) of a
signal and applied noise such that the SNR is 10,20,30,40dB
respectively, e.g.:

snr = 20*log10(norm(x30, 2)/norm(x30 - x, 2))

snr =

   30.0062

This is how the PSD looks like: http://snag.gy/rbvK5.jpg

There is a deterministic difference of 14-15dB.

I know that when you do the plot the FFT you need to add
10*log10(FFT_SIZE) to get from SNR to the noise floor, e.g. for a
single-sided spectrum with 1024 FFT:

Nfloor = -SNR - 10*log10(1024/2)

However, in my PSD I can't relate the 14-15dB with any parameter ... not
NFFT (which is 1024 and therefore also the data size of the PSD), not fs
(150MHz), not the window size (512), ...

What are the 14dB?

Thanks
Peter
Part of my answer is that you are assuming noise floor is same as snr but
they are not.
By adding noise you are lifting noise floor not just in stop band but
within signal band. 	 

_____________________________		
Posted through www.DSPRelated.com
To add further note:

if your signal bandwidth is full Nyquist then SNR and noise floor will be
same.	 

_____________________________		
Posted through www.DSPRelated.com
On Sat, 21 Jun 2014 01:14:52 -0700, Peter Mairhofer <63832452@gmx.net>
wrote:

>Hi, > >Just confused ... I created PSD plots (with MATLAB spectrum.welch) of a >signal and applied noise such that the SNR is 10,20,30,40dB >respectively, e.g.: > >snr = 20*log10(norm(x30, 2)/norm(x30 - x, 2))
Why are you using norm() here, and I've no idea what x30 or x are. For signal vector S and noise vector N: snr=10*log10(var(S)/var(N));
>snr = > > 30.0062 > >This is how the PSD looks like: http://snag.gy/rbvK5.jpg > >There is a deterministic difference of 14-15dB. > >I know that when you do the plot the FFT you need to add >10*log10(FFT_SIZE) to get from SNR to the noise floor, e.g. for a >single-sided spectrum with 1024 FFT: > >Nfloor = -SNR - 10*log10(1024/2)
I'm not sure what you're trying to do here, either. Are you trying to convert the psd to some specific unit of measure or normalize it to something?
>However, in my PSD I can't relate the 14-15dB with any parameter ... not >NFFT (which is 1024 and therefore also the data size of the PSD), not fs >(150MHz), not the window size (512), ... > >What are the 14dB? > >Thanks >Peter
If the signal and noise are transformed with the same FFT (which is difficult not to do), then the psd units for the signal will be the same as for the noise. So normalizing 0dB to the peak of the signal (actually S+N) as you have done is very common. It is a small issue that the 0dB reference at the top of the signal BW is actually S+N, so the distance from 0dB on your plot to the noise floor is actually (S+N)/N rather than just S/N. This is usually a minor issue and does not explain your 14dB discrepancy. I suspect your SNR computation is not what you think it is. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
from my observation on snr:

snr(time domain) = noise floor - 10*log10(Nyquist/bw);

in this case your bandwidth is 5MHz (and Fs = 150Mhz) so
you get extra 10*log10(75/5) = 11.76 dB

the explanation is that there is less noise for narrower band.
if you increase bw approaching Nyquist you will approach snr = noise
floor.

	 

_____________________________		
Posted through www.DSPRelated.com
On Sat, 21 Jun 2014 12:29:21 -0500, "kaz" <37480@dsprelated> wrote:

> >from my observation on snr: > >snr(time domain) = noise floor - 10*log10(Nyquist/bw);
SNR requires knowledge of the signal power, which does not appear to be part of this equation.
>in this case your bandwidth is 5MHz (and Fs = 150Mhz) so >you get extra 10*log10(75/5) = 11.76 dB
It looks like you're trying to get the psd specifically to a 1/Hz measure. The OP hasn't indicated that that's what he's trying to do. It looks to me like he's trying to figure out why he's computed 30 dB SNR but the plot shows ~44dB.
>the explanation is that there is less noise for narrower band. >if you increase bw approaching Nyquist you will approach snr = noise >floor.
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
by noise floor I meant peak power to noise floor difference (obviously).

Try it in matlab and you will see what I mean.

The post is showing about 11 dB difference between snr as measured in time
domain and snr derived from signal/noise floor difference. 

Moreover the peak is not S+N but S+Noise within band only and so this issue
is trivial.	 

_____________________________		
Posted through www.DSPRelated.com
Peter Mairhofer <63832452@gmx.net> writes:

> Hi, > > Just confused ... I created PSD plots (with MATLAB spectrum.welch) of a > signal and applied noise such that the SNR is 10,20,30,40dB > respectively, e.g.: > > snr = 20*log10(norm(x30, 2)/norm(x30 - x, 2)) > > snr = > > 30.0062 > > This is how the PSD looks like: http://snag.gy/rbvK5.jpg > > There is a deterministic difference of 14-15dB. > > I know that when you do the plot the FFT you need to add > 10*log10(FFT_SIZE) to get from SNR to the noise floor, e.g. for a > single-sided spectrum with 1024 FFT: > > Nfloor = -SNR - 10*log10(1024/2) > > However, in my PSD I can't relate the 14-15dB with any parameter ... not > NFFT (which is 1024 and therefore also the data size of the PSD), not fs > (150MHz), not the window size (512), ... > > What are the 14dB? > > Thanks > Peter
Hi Peter, I suspect that spectrum.welch returns values with a bandwidth of one Hz, independent of the implicit or explicit FFT size used. This is supported by the fact that the example plot given at the mathworks site: http://www.mathworks.com/help/signal/ref/spectrum_welch.gif for a randn() noise component, which is a unit variance, has noise at about -27 dB, and -27 is approximately 10*log10(1/500) (the entire digital bandwidth in that example). Since I don't follow all of your steps nor have all the necessary information (e.g., how you computed spectrum.welch), I can't say for sure if this is your problem or not, but I hope it points you in the right direction. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
It is just amazing how some reply with confused messy thoughts.

Let us look again at OP 

>I created PSD plots (with MATLAB spectrum.welch) of a >signal
so he did use matlab welch, isn't that clear???
>and applied noise such that the SNR is 10,20,30,40dB >respectively
Isn't that clear???
>e.g >snr = 20*log10(norm(x30, 2)/norm(x30 - x, 2)) > >snr = > > 30.0062 >
not helpful but not necessaryby now
>This is how the PSD looks like: http://snag.gy/rbvK5.jpg > >There is a deterministic difference of 14-15dB. >
it is NOT 14 but less, about 12 dB
>I know that when you do the plot the FFT you need to add >10*log10(FFT_SIZE) to get from SNR to the noise floor, e.g. for a >single-sided spectrum with 1024 FFT: > >Nfloor = -SNR - 10*log10(1024/2) >
Doesn't make sense to me, but the issue already known by now.
>However, in my PSD I can't relate the 14-15dB with any parameter ... not >NFFT (which is 1024 and therefore also the data size of the PSD), not fs >(150MHz), not the window size (512), ... > >What are the 14dB? >
This issue is reproducible and that clears it all, it is related to bandwidth of signal relative to Nyquist, see below. Try this matlab code and compare snr both ways: %%%%%%%%%%%%%%%%% %set signal bandwidth < .5 %add same noise vector to signal %by changing bandwidth snr changes for same noise vector addition. %we note that spectrum floor is same level despite snr changes ~= 40 dB %by subtracting bandwidth factor we get a match between each snr and noise floor bw = .4; n = 2^16; %create band limited signal x = randn(1,n); x = round(10000*x); h = fir1(500,bw); y = round(filter(h,1,x)); %add noise noise = round(randn(1,n)*100); yn = y + noise; snr_time_domain = 10*log10(mean(y.^2)/mean(noise.^2)) pwelch(yn,[],0,2^16,1); snr_frequency_domain = 40 - 10*log10(1/bw) %%%%%%%%%%%%%%%%%%%%%%%%%%%%% _____________________________ Posted through www.DSPRelated.com
On Sat, 21 Jun 2014 12:49:42 -0500, "kaz" <37480@dsprelated> wrote:

> >by noise floor I meant peak power to noise floor difference (obviously).
No, that's not obvious. Noise floor is something very different than peak power to noise floor difference.
>Try it in matlab and you will see what I mean. > >The post is showing about 11 dB difference between snr as measured in time >domain and snr derived from signal/noise floor difference. > >Moreover the peak is not S+N but S+Noise within band only and so this issue >is trivial.
In PSD terms, which is the context of the post and how the FFT output is interpreted (or an SA output), the values in the signal region are (S+N)/N as I stated. That is, indeed, different than using the total values Ps or Pn as (Ps+Pn)/Pn, but that's not the context or what I stated.
>_____________________________ >Posted through www.DSPRelated.com
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com