How to get the spectrum plot of a 5G NR signal generated by MATLAB?

9 views (last 30 days)
Using the 5G NR signal generator, I generated a signal and then exported the MATLAB script. Then I ran this script, hoping I'd get the same plot as what I saw on the waveform generator, but I didn't (I got the 2nd fig here). Could someone please tell me why and how I can fix this issue?
What is the unit of the waveform signal? Is it watt, dBm,..? I'm wondering by calculating rms(waveform) what would be the unit of this RMS signal.
Thanks in advance!
Susan on 11 Jan 2023
Edited: Susan on 11 Jan 2023
Hi @William Rose, Thank you so much for your response. I couldn't attach the waveform generated using the app because its size exceeds 5 MB. You can access it here
, and the sampling rate is 122880000. Please let me know if you need more info.
This signal then goes through the spectrum analyzer as follows and I get the 2nd fig above
spectrum = dsp.SpectrumAnalyzer('SampleRate', Fs);

Sign in to comment.

Accepted Answer

William Rose
William Rose on 12 Jan 2023
I downloaded and unzipped the large data file, waveform.mat, using the link you provided. I see that the signal is complex, with fs=122.88 MHz and duration T=0.02 s. I ran the commands you suggested. I got the same result you got: the "bad" spectrum, consisting of a horizontal line.
The code you suggested using to make the spectrum included no options other than setting the sampling rate:
spectrum = dsp.SpectrumAnalyzer('SampleRate', Fs);
The screenshot you posted from the Wireless Waveform Generator (WWG) has many options on the left side. I suspect that the code that got exported did not include all the options that were set in the WWG tool. I am not a regular user of the Spectrum Analyzer Tool, and, as I mentioned before, I don't have the 5G toolbox and therefore do not have the WWG.
Let's compute the spectrum "by hand":
The screenshot of the good spectrum, which you posted, and the bad spectrum both show RBW (resolution band width)=120 kHz. Therefore I will compute the spectrum with Welch's method, and I will use a Hann window of width Nw=fs/fRBW=1024 points. I choose Welch's method and a Hann window because the Signal Analyzer appears to use these by default.
%% Get data
fs=122.88e6; %sampling rate (Hz)
fRBW=120e3; %resolution bandwidth (Hz)
Nw=fs/fRBW; %window width (points)
%% Compute spectrum
pdBm=db(pxx*1e3,'power'); %convert power to dBm
%% Plot spectrum
ylabel('dBm'); xlabel('Frequency (MHz)'); grid on; xlim([-62,62]);
The code above makes the figure below. This is very much like the good spectrum you posted, but less noisy. The height of the center plateau is the same (-30 dBm), the low values on the sides are similar (<-60 dBm), the frequency range is the same (+- 61 MHz), and the plateau cutoff frequencies are very similar (about +-48 MHz).
Good luck @Susan

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by