# lteFrequencyOffset

Frequency offset estimation using cyclic prefix

## Syntax

``foffset = lteFrequencyOffset(cfgdl,waveform)``
``foffset = lteFrequencyOffset(cfgul,waveform)``
``````[foffset, corr] = lteFrequencyOffset(___)``````
``````[foffset, corr] = lteFrequencyOffset(___,toffset)``````

## Description

````foffset = lteFrequencyOffset(cfgdl,waveform)` estimates the average frequency offset, `foffset`, of the time-domain waveform, `waveform`, by calculating correlation of the cyclic prefix. The parameters of `waveform` are given in the downlink settings structure, `cfgdl`. `cfgdl` must contain the field `NDLRB` to specify that a downlink signal is expected in `waveform`. ```

example

````foffset = lteFrequencyOffset(cfgul,waveform)` estimates the average frequency offset, `foffset`, of the time-domain waveform, `waveform`, by calculating correlation of the cyclic prefix. The parameters of `waveform` are given in the uplink settings structure, `cfgul`. `cfgul` must contain the field `NULRB` to specify that an uplink signal is expected in `waveform`. ```
``````[foffset, corr] = lteFrequencyOffset(___)``` also returns a complex matrix, `corr`, spanning one slot and containing the same number of antennas, or columns, as `waveform`. `corr` is the signal used to extract the timing of the correlation for the estimation of the frequency offset.```
``````[foffset, corr] = lteFrequencyOffset(___,toffset)``` provides control over the position in the correlator output used to estimate the frequency offset. When present `toffset` is the timing offset in samples from the start of the correlator output to the position used for the frequency offset estimation. This input allows a timing offset to be calculated externally on a signal of longer duration than the input `waveform`. Which allows a short-term frequency offset estimate to be obtained while retaining the benefit of a longer-term timing estimate. NoteIf `toffset` is absent, the quality of the internal timing estimate is subject to the length and signal quality of the input `waveform` and, therefore, it may result in inaccurate frequency offset measurements. ```

## Examples

collapse all

Perform frequency offset estimation and correction on an uplink signal, to which a frequency offset has been applied.

`[txWaveform,rgrid,cfg] = lteRMCULTool('A3-2',[1;0;0;1],'Fdd',2);`

Apply an arbitrary frequency offset of 51.2 Hz.

```t = (0:length(txWaveform)-1).'/cfg.SamplingRate; txWaveform = txWaveform .* exp(1i*2*pi*51.2*t);```

Estimate and display the frequency offset.

```offset = lteFrequencyOffset(cfg,txWaveform); disp(['Frequency offset: ' num2str(offset) ' Hz'])```
```Frequency offset: 51.2 Hz ```

Correct for frequency offset.

`rxWaveform = lteFrequencyCorrect(cfg,txWaveform,offset);`

Perform SC-FDMA demodulation.

`rxGrid = lteSCFDMADemodulate(cfg,rxWaveform);`

## Input Arguments

collapse all

Downlink configuration, specified as a structure having the following fields.

Parameter FieldRequired or OptionalValuesDescription
`NDLRB`Required

Scalar integer from 6 to 110

Number of downlink resource blocks (${N}_{\text{RB}}^{\text{DL}}$)

`CyclicPrefix`Optional

`'Normal'` (default), `'Extended'`

Cyclic prefix length

`DuplexMode`Optional

`'FDD'` (default), `'TDD'`

Duplexing mode, specified as either:

• `'FDD'` for Frequency Division Duplex

• `'TDD'` for Time Division Duplex

The following apply when `DuplexMode` is set to `'TDD'`.

`TDDConfig`Optional

0, 1 (default), 2, 3, 4, 5, 6

`SSC`Optional

0 (default), 1, 2, 3, 4, 5, 6, 7, 8, 9

Special subframe configuration (SSC)

`NSubframe`Optional

0 (default), nonnegative scalar integer

Subframe number

Data Types: `struct`

Uplink configuration, specified as a structure having the following fields.

Parameter FieldRequired or OptionalValuesDescription
`NULRB`Required

Scalar integer from 6 to 110

Number of uplink resource blocks. (${N}_{\text{RB}}^{\text{UL}}$)

`CyclicPrefixUL`Optional

`'Normal'` (default), `'Extended'`

Cyclic prefix length

`DuplexMode`Optional

`'FDD'` (default), `'TDD'`

Duplexing mode, specified as either:

• `'FDD'` for Frequency Division Duplex

• `'TDD'` for Time Division Duplex

The following apply when `DuplexMode` is set to `'TDD'`.

`TDDConfig`Optional

0, 1 (default), 2, 3, 4, 5, 6

`SSC`Optional

0 (default), 1, 2, 3, 4, 5, 6, 7, 8, 9

Special subframe configuration (SSC)

`NSubframe`Optional

0 (default), nonnegative scalar integer

Subframe number

Data Types: `struct`

Input time-domain waveform, specified as a numeric column vector.

Data Types: `double` | `single`
Complex Number Support: Yes

Timing offset, specified as a scalar value expressed in samples. Use `toffset` to control the position in the correlator output used to estimate the frequency offset. If `toffset` is absent, or empty, the position of the peak magnitude of the correlator output is used.

Data Types: `double` | `single`

## Output Arguments

collapse all

Average frequency offset estimate, returned as a scalar value expressed in Hertz. This function can only accurately estimate frequency offsets of up to ±7.5 kHz (a range of 15 kHz, the subcarrier spacing).

Data Types: `double` | `single`

Correlation timing signal, returned as a numeric matrix. `corr` is a complex matrix that spans one slot and contains the same number of antennas, or columns, as `waveform`. It is the signal used to extract the timing of the correlation for the frequency offset estimation.

Data Types: `double` | `single`
Complex Number Support: Yes

## Version History

Introduced in R2014a
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 2, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6493728160858154, "perplexity": 10459.305637697951}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2022-40/segments/1664030337446.8/warc/CC-MAIN-20221003231906-20221004021906-00352.warc.gz"}