A few questions about the output value of dsp.SpectrumAnalyzer
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am testing the output values of dsp.SpectrumAnalyzer for a sine wave mixed with white noise. The \sigma^2 of the white noise is 1e-4, so I use 0.01*randn(1024,1) to generate it. The sine wave is generated by dsp.SineWave with default amplitude (=1). The sampling rate is 44100 Hz. If the 'SpectrumType' property of dsp.SpectrumAnalyzer is set by default ('Power'), the scope output is as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155287/image.png)
According to the analysis in "Convert the Power in Watts to dBW and dBm" section of Estimate the Power Spectral Density in MATLAB , The peak is at 26.9897 dBm, which is what the above screenshot shows us. But other values in the figure confused me. I will ask them one by one.
(1) The power spectrum of the white noise is \sigma^2=1e-4 (right?), which is 10*log10(1e-4/1e-3)=-10dBm according to the definition in the above link. But the figure shows that the power spectrum of the white noise is at -40dBm. How is this value obtained? PS: if we calculate the power spectrum in dBW, 10*log10(1e-4)=-40 which is close to what the figure shows, but here I am using dBm unit!
(2) If I change the 'SpectrumType' property of dsp.SpectrumAnalyzer to 'Power density', the output of the System object is as follows:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155289/image.png)
According to the explanation of this property in documentation dsp.SpectrumAnalyzer System object, now the peak of the sine wave should be "the magnitude squared of the spectrum normalized to a bandwidth of 1 hertz.". The spectrum is 0.5, so its square is 0.25, what I expected to get in dBm should be 10*log10(0.25/1e-3)=23.9794dBm, but what I can see in the figure is 12.6948 dBm. How is this value obtained?
(3) Let's look at the power spectrum density of the white noise again. According to the definition mentioned in the above question, the value should be 10*log10(1e-4^2/1e-3)=-50dBm. I'm not sure if the calculation is correct, but it is close to the figure, although there seems to be some distance. The question is, the section "Convert the Power in Watts to dBW and dBm" of Estimate the Power Spectral Density in MATLAB says the P_{whitenoise}=1e-4*(22050/21.53)=0.1024, but if we calculate the dBm, we get 10*log10(0.1024^2/1e-3)=10.2060. To my surprise, the webpage then says "the total power of the white noise is -39.87 dBm." How is this -39.87 dBm obtained?
I'm totally confused about these values. I will greatly appreciate it if you can help me clarify them. Thanks a lot!
The following are some reference code for your experiment. I am using the latest 2016a.
Fs = 44100;
Sineobject1 = dsp.SineWave('SamplesPerFrame',1024, 'PhaseOffset',10, 'SampleRate',Fs,'Frequency',5000);
SA = dsp.SpectrumAnalyzer('SampleRate',Fs,'SpectrumType','Power',...
'PlotAsTwoSidedSpectrum',false,'Window','Hann',...
'ChannelNames',{'PSD of the input'},'ShowLegend',true);
for Iter = 1:5
Sinewave1 = step(Sineobject1);
Input = Sinewave1;
NoisyInput = Input + 0.01*randn(1024,1);
step(SA,NoisyInput);
end
0 comentarios
Respuestas (1)
Honglei Chen
el 2 de Ag. de 2016
Here is how I look at it:
(1) For all those FFT based spectrum analysis tool, the theory behind it is that the base of FFT matches to a series of frequencies. So when you apply FFT to the signal, it helps the frequency components of the signal to stand out. Essentially, you can think of that the signal gets amplified by the length of the signal. However, because noise is uncorrelated form sample to sample, it does not benefit from such a gain. Therefore, when at the end the spectrum peak values gets scaled back to match the signal power, the noise gets suppressed even more. In essence, I don't think you can use the spectrum to read out the noise floor reliably. In your example, there is a 37 dB difference between the signal and the noise. You may need to add another ~30 dB difference because your signal is about 1000 samples long, so that brings the difference to 67 dB, I'd say that matches what you see.
(2) There are probably some misunderstanding regarding the document. Essentially both power and power density measures power, so you don't have to square the 0.5 any more. In addition, power density is power normalized by the frequency bin. Therefore, in your case, since you are dividing the Nyquest rate, 44.1 kHz/2 = 22.05 kHz, into approximately 1000 bins, each bin is about 22 Hz. Therefore, the result is approximately 10*log10(500/22) = 13.6 dB, which is close to what you see. In fact, the figure in (1) and (2) should essentially be the same, just off by a factor of frequency bin width. Therefore, the difference between (1) and (2) can be computed as 10*log10(22) = 13.4 dB. So, if you look at the peak value in (1), which is 26 dB and subtract 13.4 dB from it, you get 12.6 dB, which is peak value in (2)
(3) I think you are right that the result isn't quite right but your computation also contain mistakes. In the documentation, the P_{whitenoise} is given by 1e-4*22050/21.53. This is already in power, so you don't have to square it any more. All you have to do is to translate it into dBm
>> 10*log10(1e-4*22050/21.53/1e-3)
ans =
20.1036
HTH
0 comentarios
Ver también
Categorías
Más información sobre Spectral Analysis en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!