# Use Default OFDM Sample Rate and Default FFT Size

This example shows how the OFDM functions (`nrOFDMModulate`, `nrOFDMInfo`, and `nrOFDMDemodulate`) set the default value for the sample rate input, `SampleRate`, and the default value for the fast Fourier transform (FFT) size input, `Nfft`, 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 do not specify a value for the `Nfft` input, or you specify `'Nfft',[]`.

### Default OFDM Sample Rate

The default value set for the `SampleRate` input is equal to `Nfft*carrier.SubcarrierSpacing*1000`, where `carrier` is the input argument of the function call that specifies the carrier configuration.

### Default FFT Size

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

• `Nfft` is an integer greater than 127 (to ensure integer-valued cyclic prefix lengths)

• `Nfft` is a power of 2.

• `Nfft` results in a maximum occupancy of 85%. The actual occupancy is equal to `carrier.NSizeGrid*12/Nfft`.

### Plot Bandwidth Occupancy

Create a carrier configuration object.

`carrier = nrCarrierConfig;`

Calculate the actual occupancy equal to `carrier.NSizeGrid*12/Nfft` for all `NSizeGrid` values.

```nSizeGrids = 1:275; defaultOccupancy = zeros(1,275); for nSizeGrid = nSizeGrids carrier.NSizeGrid = nSizeGrid; ofdmInfo = nrOFDMInfo(carrier); defaultOccupancy(nSizeGrid) = carrier.NSizeGrid*12/ofdmInfo.Nfft; end```

Plot the actual occupancy. Highlight the occupancy for `NSizeGrid` values `52`, `106`, `160`, and `216`.

```figure; plot(nSizeGrids,defaultOccupancy,'x'); hold on; typicalNSizeGrids = [52 106 160 216]; plot(typicalNSizeGrids,defaultOccupancy(typicalNSizeGrids),'ro','MarkerFaceColor','r'); title('Bandwidth Occupancy for Default Sample Rate and Default FFT Size'); axis([1 275 0 1]); xlabel('NSizeGrid'); xticks([1 typicalNSizeGrids 275]); ylabel('Bandwidth Occupancy (NSizeGrid*12/Nfft)');```

Ignore the smallest `NSizeGrid` values.

`defaultOccupancy(1:5) = NaN;`

Find the minimum occupancy and the corresponding `NSizeGrid` value.

`[occupancyMin,nSizeGridMin] = min(defaultOccupancy)`
```occupancyMin = 0.4277 ```
```nSizeGridMin = 73 ```

Find the maximum occupancy and the corresponding `NSizeGrid` value.

`[occupancyMax,nSizeGridMax] = max(defaultOccupancy)`
```occupancyMax = 0.8496 ```
```nSizeGridMax = 145 ```