Main Content

Use Custom OFDM Sample Rate and Default FFT Size

This example shows how the OFDM functions (nrOFDMModulate, nrOFDMInfo, and nrOFDMDemodulate) set the default value for the fast Fourier transform (FFT) size input, Nfft, when you call an OFDM function and these conditions apply.

  • You specify a custom value for the sample rate input, SampleRate.

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

Custom OFDM Sample Rate

The value that you set for the SampleRate input determines the sample rate of the waveform.

The nominal sample rate corresponding to the FFT size used in the OFDM modulation, FFTSR, is equal to Nfft*carrier.SubcarrierSpacing*1000, where carrier is the input argument of the function call that specifies the carrier configuration.

Because the resampling of the OFDM-modulated waveform is by a factor of SampleRate/FFTSR, the resampling is costly if SampleRate and FFTSR do not have large common factors.

Default FFT Size

The default value set for the Nfft input satisfies these conditions.

  • Nfft is a multiple of 128, that is, Nfft = 128 * Y (to ensure integer-valued cyclic prefix lengths).

  • The lower bound of Y is equal to ceil((carrier.NSizeGrid*12/0.85)/128). That is, the lower bound depends on the maximum FFT occupancy of 85%.

  • The upper bound of Y is equal to ceil((2*SampleRate/(carrier.SubcarrierSpacing*1000))/128). That is, the upper bound depends on the sample rate you specify.

  • Y maximizes the common factors of the nominal and specified sample rates, that is, gcd(FFTSR,SampleRate).

Plot Bandwidth Occupancy

Create a carrier configuration object.

carrier = nrCarrierConfig;

Set the SampleRate for each NSizeGrid value to give an occupancy of 75%.

nSizeGrids = 1:275;
userSampleRateDefaultNfft = zeros(1,275);
fftOccupancy = zeros(1,275);
for nSizeGrid = 1:275    
    carrier.NSizeGrid = nSizeGrid;
    % Transmission bandwidth of OFDM waveform
    txBW = carrier.NSizeGrid*12*carrier.SubcarrierSpacing*1000;
    sr = txBW / 0.75;
    ofdmInfo = nrOFDMInfo(carrier,'SampleRate',sr);
    userSampleRateDefaultNfft(nSizeGrid) = ofdmInfo.Nfft;
    fftOccupancy(nSizeGrid) = carrier.NSizeGrid*12/ofdmInfo.Nfft;
end

Plot the resulting Nfft values.

figure;
plot(nSizeGrids,userSampleRateDefaultNfft,'x');
title({'FFT Size for Custom Sample Rate' 'with Bandwidth Occupancy of 75%'});
axis([1 275 min(userSampleRateDefaultNfft) max(userSampleRateDefaultNfft)]);
xlabel('NSizeGrid');
xticks([1 52 106 160 216 275]);
ylabel('FFT Size');
yticks([min(userSampleRateDefaultNfft) 1024:1024:8192 max(userSampleRateDefaultNfft)]);

Plot the resulting FFT occupancy.

figure;
plot(nSizeGrids,fftOccupancy,'x');
title({'FFT Occupancy for Custom SampleRate' 'with Bandwidth Occupancy of 75%'});
axis([1 275 0 1]);
xlabel('NSizeGrid');
xticks([1 52 106 160 216 275]);
ylabel('FFT Occupancy');

See Also

Functions

Related Topics