Borrar filtros
Borrar filtros

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

14 visualizaciones (últimos 30 días)
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 comentarios
William Rose
William Rose el 11 de En. de 2023
Hi, @Susan.
My university does not have the 5G toolbox so I cannot open the 5G signal genrator app.
If you upload a file with the time domain signal that is generated by the app, I will look at it. (Specify sampling rate if it's not obvious.) The script probably calls functions in the toolbox that I don't have.
Susan
Susan el 11 de En. de 2023
Editada: Susan el 11 de En. de 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
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);

Iniciar sesión para comentar.

Respuesta aceptada

William Rose
William Rose el 12 de En. de 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);
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 comentarios
William Rose
William Rose el 12 de En. de 2023
@Susan, if you inspect the spectrum plot made by my code, or if you inspect the vector f made by my code, you will see that the frequencies are separated by 1.2e5 = 120 kHz. This is the resolution bandwith of the original spectra which you posted. This happened in my code because I chose a window length of Nw=fs/(1.2e5).
Susan
Susan el 12 de En. de 2023
@William Rose Thank you so much for your response and detailed explanation.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by