# Power Spectral Density units

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)

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

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 Any comments /suggestions

Thanks

• What is RBW above? – Dsp guy sam May 7 at 7:53
• RBW in MATLAB is set to 100 KHz and the hardware's default RBW is 100KHz – Saira May 7 at 7:54
• Do you have the Matlab code you can share? – teeeeee May 7 at 11:09
• @teeeeee The MATLAB code is pretty basic sprctrum analyzer . I just changed few settings and got the output in GREEN . the input to the spectrum analyzer is IQ samples which is a WiFi packet of 20 MHz bandwidth and 80 MHz sampling rate. – Saira May 7 at 14:58
• I have added the code in main question – Saira May 7 at 15:01

The division should be by 100000, but I doubt that hardware is giving the result in actual milliwatts, maybe a normalization is required in the power being reported by the hardware as well followed by a subsequent normalization in bandwidth. This would require knowing how the hardware is generating this number,

considerations like, what is amount of duration over which hardware measures this spectrum, does it average out over those durations or does it provide cumulative value which needs to be normalized.

• I have limited knowledge of the hardware (its litepoint box) and I'm sending IQ sample file to its VSA directly (instead of sending through SigGen and then to VSA)... so I don't have a capture time in this case .. – Saira May 7 at 8:13
• I believe this is what hardware is doing in this case ... Divide n IQ samples into k segments ... apply DFT to all k segments with guassian or hann windowing,,, and then do exponential averaging.. just a hunch though – Saira May 7 at 8:15
• The reference load for matlab is set to 1 ohm by default, whereas lite point reference impedance is 50 ohms – Saira May 7 at 8:32
• Then the power will be different, power varies linearly with resistance when the input current is held constant – Dsp guy sam May 7 at 16:31
• Is the sampling rate same in both cases? The DFT size? Reason fir asking these questions is to check the binwidth of the PSD, – Dsp guy sam May 7 at 16:35

MATLAB's Spectrum Analyzer is fed with IQ samples directly . I mean it is not going through a signal Generator .

whereas for hardware, DUT is connected to VSA (Do you have any kind of attenuation in between? At what Tx power you are transmitting ? ) . These factors can lead to difference in observed power level when you are comparing outputs .

AFAIK , when you do such comparison , its always the trace which matters .

You can take the Maximum of spectrum peaks and add that offset and compare the trace for your main goal (compare the trace outputs)

• The Conversion which you did for dBm/Hz @ 1ohm to dBm/100KHz @ 50 ohm seems correct to me – Ash SDR May 8 at 3:06