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

5 ビュー (過去 30 日間)
Susan
Susan 2023 年 1 月 11 日
コメント済み: Susan 2023 年 1 月 12 日
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!
  2 件のコメント
Susan
Susan 2023 年 1 月 11 日
編集済み: Susan 2023 年 1 月 11 日
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
https://drive.google.com/file/d/1NJMSeL-oIy0tdkxOMp-5lUQi1gpg8UfH/view?usp=share_link
, 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);
spectrum(waveform);
release(spectrum);

サインインしてコメントする。

採用された回答

William Rose
William Rose 2023 年 1 月 12 日
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);
spectrum(waveform);
release(spectrum);
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
waveform=load('waveform');
x=waveform.waveform;
fs=122.88e6; %sampling rate (Hz)
fRBW=120e3; %resolution bandwidth (Hz)
Nw=fs/fRBW; %window width (points)
%% Compute spectrum
[pxx,f]=pwelch(x,hann(Nw,'periodic'),0,Nw,fs,'centered','power');
pdBm=db(pxx*1e3,'power'); %convert power to dBm
%% Plot spectrum
plot(f/1e6,pdBm,'-b');
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
  2 件のコメント
Susan
Susan 2023 年 1 月 12 日
@William Rose Thank you so much for your response and detailed explanation.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by