Main Content

Use Default OFDM Sample Rate and Custom FFT Size

This example shows how the OFDM functions (nrOFDMModulate, nrOFDMInfo, and nrOFDMDemodulate) set the default value for the sample rate input, SampleRate, when you call an OFDM function and these conditions apply.

  • You do not specify a value for the SampleRate input, or you specify 'SampleRate',[].

  • You specify a custom value for the fast Fourier transform (FFT) size input, Nfft.

Default OFDM Sample Rate

The default value set for the SampleRate input is equal to Nfft*carrier.SubcarrierSpacing*1000.

Custom FFT Size

The value that you set for the Nfft input must satisfy these conditions.

  • Nfft is an integer (to ensure integer-valued cyclic prefix lengths).

  • Nfft is a power of 2.

  • Nfft results in a maximum occupancy of 100%. The actual occupancy is equal to carrier.NSizeGrid*12/Nfft, where carrier is the input argument of the function call that specifies the carrier configuration.

Plot Bandwidth Occupancy

Create a carrier configuration object.

carrier = nrCarrierConfig;

Set the Nfft for each NSizeGrid value to give an occupancy of at most 90%.

nSizeGrids = 1:275;
userNfftOccupancy = zeros(1,275);
sampleRate = zeros(1,275);
for nSizeGrid = nSizeGrids   
    carrier.NSizeGrid = nSizeGrid;
    nfft = 128 * ceil(carrier.NSizeGrid*12/0.9/128);
    ofdmInfo = nrOFDMInfo(carrier,'Nfft',nfft);
    userNfftOccupancy(nSizeGrid) = carrier.NSizeGrid*12/ofdmInfo.Nfft;
    sampleRate(nSizeGrid) = ofdmInfo.SampleRate/1e6;  
end

Plot the resulting occupancy.

figure;
plot(nSizeGrids,userNfftOccupancy,'x');
title({'Bandwidth Occupancy for Default Sample Rate' 'with FFT Size Selected for Maximum Occupancy of 90%'});
axis([1 275 0 1]);
xlabel('NSizeGrid');
xticks([1 52 106 160 216 275]);
ylabel('Bandwidth Occupancy (NSizeGrid * 12 / Nfft)');

Figure contains an axes object. The axes object with title Bandwidth Occupancy for Default Sample Rate with FFT Size Selected for Maximum Occupancy of 90%, xlabel NSizeGrid, ylabel Bandwidth Occupancy (NSizeGrid * 12 / Nfft) contains a line object which displays its values using only markers.

Plot the resulting sample rate.

figure;
plot(nSizeGrids,sampleRate,'x');
title({'Default Sample Rate' 'with FFT Size Selected for Maximum Occupancy of 90%'});
axis([1 275 0 max(sampleRate)]);
xlabel('NSizeGrid');
xticks([1 52 106 160 216 275]);
ylabel('Sample Rate (Ms/s)');

Figure contains an axes object. The axes object with title Default Sample Rate with FFT Size Selected for Maximum Occupancy of 90%, xlabel NSizeGrid, ylabel Sample Rate (Ms/s) contains a line object which displays its values using only markers.

See Also

Functions

Related Topics