1
\$\begingroup\$

I am trying to compare power spectral density values (obtained from dsp.SpectrumAnalyzer) with PSD values obtained from hardware which has a VSA. MATLAB's documentation says that " The power spectral density is the magnitude squared of the spectrum normalized to a bandwidth of 1 hertz." and expressed in dBm/Hz

whereas the hardware expresses PSD in units dBm/RBW per 100 kHz So,I'm assuming that it is normalized w.r.t 100Khz bandwidth This is an example snippet of hardware's vsa( not my actual output) enter image description here

Do I need to do any kind of conversion or something in terms of PSD ? For ex: dBm-->mW--> multiply by 100e3 something like that to properly compare? Kind of confused with these units. MATLAB's output is off by approx 20 dBm

Here is the output comparison enter image description here

EDIT>>>

0) RBW is set to 100KHz on hardware and in MATLAB too 1) I'm guessing there is a factor 100 which I need to multiply to PSD in mW to make it similar, but not sure why I need to do that

2)The reference load for matlab is set to 1 ohm by default, whereas hardware (litepoint ) reference impedance is 50 ohms

3) Updating basic specAnalyzer code in matlab if that helps in understanding

nSpectralAverages = 3;
specAnalyzer = dsp.SpectrumAnalyzer('SpectrumType','Power density',...
                              'SampleRate',fs);
specAnalyzer.FrequencySpan = 'Span and center frequency';
specAnalyzer.Span = psdSpanLpVSA;
specAnalyzer.SpectralAverages = nSpectralAverages;
% Resolution Bandwidth
specAnalyzer.RBWSource = 'Property';
specAnalyzer.RBW = resolutionBandwidthHz;

specAnalyzer.AveragingMethod = 'Exponential';
specAnalyzer.ForgettingFactor = 1;
% Run the spec An and get collective result
specAnalyzer(WiFi_iqData_bw20MHz);
specData = specAnalyzer.getFramework.Visual;

I'm using exponential averaging method as its pretty clean and similar to litepoint's output

4) My other question is: Can I even compare outputs directly like this? Or should I just add the difference in spectrum peaks and then compare (after adding 50 Ohms to the MATLAB's output)

EDIT 5) I have converted dB/Hz (which matlab provides) to dBm/100Khz for comparison and also calculated power values for 50 ohm

Pwr in dBm/Hz --> convert to mW --> multiply by 10000/50 (100e3 for 100KHz and 50 for 50 ohms conversion)  --> then reconvert to dBm

Here is the output enter image description here Any comments /suggestions

Thanks

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Put in a pure sinewave as a calibration, something that you know. Little point in debugging a complex signal if you can't make a simple one work. Use Parseval's Theorem to get a stake in the ground for a point of comparison, the power of the signal you compute has to be the same whether it's computed as the sum over frequency bins or the sum over time samples. That's true for sine or complex. Make sure you understand whether you're averaging the spectral power, or the dB of the spectral power, there's up to another 2.5dB variation available when averaging noise-like signals. \$\endgroup\$
    – Neil_UK
    Commented May 8, 2020 at 7:24
  • \$\begingroup\$ Thanks Neil_UK for the suggestion. I will try out that now \$\endgroup\$
    – Saira
    Commented May 8, 2020 at 13:11
  • 1
    \$\begingroup\$ I'll let you into a secret. For much of the later part of my working life, I was doing spectral analysis with MATLAB, python, raw C code, digitisers, FFTs from different sources, bench spectrum analysers, and I couldn't really be bothered with the tracking the signal levels for different bandwidths, reference levels, FFT normalisations etc etc, so I'd run a pure sinewave through each system, and let that be my calibration. OK, if we were selling something, then I'd dot the i's and cross the t's, but it saved a lot of time, and mistakes, and hair being pulled out. \$\endgroup\$
    – Neil_UK
    Commented May 8, 2020 at 13:28
  • \$\begingroup\$ @Neil_UK thanks for the secret neil.. learned it hard way but was worth spending time on this. thanks again .. Will definitely try the way and take that as calibration. \$\endgroup\$
    – Saira
    Commented May 8, 2020 at 22:09

1 Answer 1

1
\$\begingroup\$

The MATLAB documentation says the default RBW is 9.76Hz, so for the same resistance the MATLAB solution would be expected to be -10*log(100,000/9.76) = -40.1dBm

However the resistance is 1/50 so the power density will be 10*log(50) higher or +17.0dBm so total -23.1dBm.

Still not quite right unless there's something going on with negative frequencies to get that 2:1 factor.

\$\endgroup\$
1
  • \$\begingroup\$ I changed the RBW value to be 100KHz in matlab \$\endgroup\$
    – Saira
    Commented May 8, 2020 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.