stenzer
Advanced Member level 3
Hi,
I used a desktop oscilloscope to estimate the SNR of a sinusodial signal source. Therfore I took 800E3 samples, which I'm analyzing with MATLAB.
I used the periodogram function to determine the power spectrum and the power spectral density by (see attached image)
fs is the sampling frequency.
I can use MATLAB's built in function to determine the SNR by
which are both resulting in an SNR of about 42.5 dB.
I had a look on the SNR documentation, but for me its not clear how the SNR is calculated. I know how it is defined ( SNR_dB = 10 . log10(Signal_RMS²/Noise_RMS²) ).
The PSD's amplitude (lower subplot) is given in dB/Hz. So, what I have in mind is to intergrate the spectrum from 0 to 250 MHz (like I would do it for a given noise bandwith in V/sqrt(Hz)), neglecting the carrier frequency around 10 MHz.
So I identyfied the index (idxF) of the carrier frequency. The vector pxx consists of linear values so its unit should be Watt/Hz, and not dB/Hz (I hope that's correct). I integrated the spectrum (lower plot in the figure) by
and neglected the DC component (start with index 2). The integral results in a power of NOISE_W = 2.8 Watt. The signal power SIGNAL_dB can be obtained from the upper plot in the figure, and is 4 dB which corresponds to 2.5 W (10^(4/10)).
As can be seen, I made something wrong because the noise power NOISE_W is larger than SIGNAL_W, leading to a negative SNR.
So please can someone explain me, how I can calculate the SNR by the use of the PSD. I know, I could use the MATLAB function, but I want to know how it works :???:.
BR
I used a desktop oscilloscope to estimate the SNR of a sinusodial signal source. Therfore I took 800E3 samples, which I'm analyzing with MATLAB.
I used the periodogram function to determine the power spectrum and the power spectral density by (see attached image)
Code:
[pxx_pow,f_pow] = periodogram(Data,kaiser(length(Data_RAW),38),[],fs,'power')
[pxx,f] = periodogram(Data_RAW,kaiser(length(Data),38),[],fs,'psd')
fs is the sampling frequency.
I can use MATLAB's built in function to determine the SNR by
Code:
snr(Data,fs)
snr(pxx,fs,'psd')
which are both resulting in an SNR of about 42.5 dB.
I had a look on the SNR documentation, but for me its not clear how the SNR is calculated. I know how it is defined ( SNR_dB = 10 . log10(Signal_RMS²/Noise_RMS²) ).
The PSD's amplitude (lower subplot) is given in dB/Hz. So, what I have in mind is to intergrate the spectrum from 0 to 250 MHz (like I would do it for a given noise bandwith in V/sqrt(Hz)), neglecting the carrier frequency around 10 MHz.
So I identyfied the index (idxF) of the carrier frequency. The vector pxx consists of linear values so its unit should be Watt/Hz, and not dB/Hz (I hope that's correct). I integrated the spectrum (lower plot in the figure) by
Code:
NOISE_W = trapz([f(2:idxF-1);f(idxF+1:end)],[pxx(2:idxF-1);pxx(idxF+1:end)])
and neglected the DC component (start with index 2). The integral results in a power of NOISE_W = 2.8 Watt. The signal power SIGNAL_dB can be obtained from the upper plot in the figure, and is 4 dB which corresponds to 2.5 W (10^(4/10)).
As can be seen, I made something wrong because the noise power NOISE_W is larger than SIGNAL_W, leading to a negative SNR.
So please can someone explain me, how I can calculate the SNR by the use of the PSD. I know, I could use the MATLAB function, but I want to know how it works :???:.
BR