# lteEVM

Error vector magnitude calculation

## Syntax

``evm = lteEVM(x,r)``
``evm = lteEVM(ev)``

## Description

example

````evm = lteEVM(x,r)` returns a structure, `evm`, containing error vector magnitude (EVM) information for the input array, `x`, given the reference signal array, `r`. The EVM is defined using the error, or difference, between the input values, `x`, and the reference signal, `r`.The EVM values in the `RMS` and `Peak` structure fields are linear EVM, not EVM as a percentage. To obtain EVM as a percentage, multiply the value of the `RMS` and `Peak` structure fields by 100.```
````evm = lteEVM(ev)` returns a structure, `evm`, for the input array, `ev`, which is taken to be the normalized error vector given by the expression `ev=(x-r)/sqrt(mean(abs(r.^2)))`. This syntax allows for peak and RMS EVM calculation for preexisting normalized error vectors. For example, it can be used to calculate the EVM across an array of previous EVM results, by extracting and concatenating the EV fields from the array to form the `ev` input vector.```

## Examples

collapse all

Generate a random QPSK constellation at a defined EVM level. Measure and confirm the added EVM.

Generate a stream of QPSK symbols.

`txSym = lteSymbolModulate(randi([0,1],10000,1),'QPSK');`

Add noise at a defined EVM level, `evmPercent`.

```evmPercent = 14.0; N0 = complex(randn(size(txSym)),randn(size(txSym))); noise = N0 * (evmPercent/100)/sqrt(2); rxSym = txSym + noise;```

Measure and display the root mean square EVM level in percent.

`evm = lteEVM(rxSym,txSym)`
```evm = struct with fields: EV: [5000x1 double] Peak: 0.4260 RMS: 0.1382 ```
`evm.RMS*100`
```ans = 13.8234 ```

## Input Arguments

collapse all

Input array, specified as a column vector, matrix or 3-D array.

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

Reference signal array, specified as a column vector, matrix or 3-D array.

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

Normalized error array, specified as a column vector, matrix or 3-D array.

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

## Output Arguments

collapse all

EVM information, returned as structure. `evm` contains the following fields.

Root mean square (RMS) EVM, specified as a positive numeric scalar. It is the square root of the mean of the squares of all the values of the EVM.

Data Types: `double` | `single`

Peak EVM, returned as a positive numeric scalar. It is the largest single EVM value calculated across all input values.

Data Types: `double` | `single`

Normalized error vector, returned as a numeric column vector.

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

Data Types: `struct`