Convert compensator coefficient to amplitude and phase imbalance

Use `iqcoef2imbal`

to estimate the amplitude and phase imbalance for a given complex coefficient. The coefficients are an output from the `step`

function of the `IQImbalanceCompensator`

.

Create a raised cosine transmit filter to generate a 64-QAM signal.

M = 64; txFilt = comm.RaisedCosineTransmitFilter;

Modulate and filter random 64-ary symbols.

data = randi([0 M-1],100000,1); dataMod = qammod(data,M); txSig = step(txFilt,dataMod);

Specify amplitude and phase imbalance.

ampImb = 2; % dB phImb = 15; % degrees

Apply the specified I/Q imbalance.

gainI = 10.^(0.5*ampImb/20); gainQ = 10.^(-0.5*ampImb/20); imbI = real(txSig)*gainI*exp(-0.5i*phImb*pi/180); imbQ = imag(txSig)*gainQ*exp(1i*(pi/2 + 0.5*phImb*pi/180)); rxSig = imbI + imbQ;

Normalize the power of the received signal

rxSig = rxSig/std(rxSig);

Remove the I/Q imbalance using the `comm.IQImbalanceCompensator`

System object. Set the compensator object such that the complex coefficients are made available as an output argument.

```
hIQComp = comm.IQImbalanceCompensator('CoefficientOutputPort',true);
[compSig,coef] = step(hIQComp,rxSig);
```

Estimate the imbalance from the last value of the compensator coefficient.

[ampImbEst,phImbEst] = iqcoef2imbal(coef(end));

Compare the estimated imbalance values with the specified ones. Notice that there is good agreement.

[ampImb phImb; ampImbEst phImbEst]

`ans = `*2×2*
2.0000 15.0000
2.0178 14.5740

`C`

— Compensator coefficientcomplex-valued scalar or vector

Coefficient used to compensate for an I/Q imbalance, specified as a complex-valued vector.

**Example: **`0.4+0.6i`

**Example: **```
[0.1+0.2i;
0.3+0.5i]
```

**Data Types: **`single`

| `double`

The function `iqcoef2imbal`

is
a supporting function for the `comm.IQImbalanceCompensator`

System object™.

Given a scaling and rotation factor, *G*, compensator
coefficient, *C*, and received signal, *x*,
the compensated signal, *y*, has the form

$$y=G\left[x+C\mathrm{conj}(x)\right]\text{\hspace{0.17em}}.$$

In matrix form, this can be rewritten as

$$Y=R\text{\hspace{0.05em}}X\text{\hspace{0.17em}},$$

where **X** is a 2-by-1 vector
representing the imbalanced signal [*X _{I}*,

The matrix **R** is expressed as

$$R=\left[\begin{array}{cc}1+\mathrm{Re}\left\{C\right\}& \mathrm{Im}\left\{C\right\}\\ \mathrm{Im}\left\{C\right\}& 1-\mathrm{Re}\left\{C\right\}\end{array}\right]$$

For the compensator to perfectly remove the I/Q imbalance, **R** = **K**^{-1} because $$X=K\text{\hspace{0.17em}}S$$, where **K** is a 2-by-2 matrix whose values are determined
by the amplitude and phase imbalance and **S** is
the ideal signal. Define a matrix **M** with
the form

$$M=\left[\begin{array}{cc}1& -\alpha \\ \alpha & 1\end{array}\right]$$

Both **M** and **M**^{-1} can
be thought of as scaling and rotation matrices that correspond to
the factor *G*. Because **K** = **R**^{-1}, the product **M**^{-1} **R** **K** **M** is the identity matrix, where **M**^{-1} **R** represents the compensator output and **K** **M** represents
the I/Q imbalance. The coefficient *α* is chosen
such that

$$K\text{\hspace{0.05em}}M=L\left[\begin{array}{cc}{I}_{gain}\mathrm{cos}({\theta}_{I})& {Q}_{gain}\mathrm{cos}({\theta}_{Q})\\ {I}_{gain}\mathrm{sin}({\theta}_{I})& {Q}_{gain}\mathrm{sin}({\theta}_{Q})\end{array}\right]$$

where *L* is a constant. From this form, we
can obtain *I _{gain}*,

$$\begin{array}{c}{\theta}_{I}=-\left(\pi /2\right)\left({\Phi}_{Imb}/180\right)\\ {\theta}_{Q}=\pi /2+\left(\pi /2\right)\left({\Phi}_{Imb}/180\right)\end{array}$$

Hence, cos(*θ _{Q}*)
= sin(

$$L\left[\begin{array}{cc}{I}_{gain}\mathrm{cos}({\theta}_{I})& {Q}_{gain}\mathrm{cos}({\theta}_{Q})\\ {I}_{gain}\mathrm{sin}({\theta}_{I})& {Q}_{gain}\mathrm{sin}({\theta}_{Q})\end{array}\right]=L\left[\begin{array}{cc}{I}_{gain}\mathrm{cos}({\theta}_{I})& {Q}_{gain}\mathrm{sin}({\theta}_{I})\\ {I}_{gain}\mathrm{sin}({\theta}_{I})& {Q}_{gain}\mathrm{cos}({\theta}_{I})\end{array}\right]$$

The I/Q imbalance can be expressed as

$$\begin{array}{c}K\text{\hspace{0.05em}}M=\left[\begin{array}{cc}{K}_{11}+\alpha {K}_{12}& -\alpha {K}_{11}+{K}_{12}\\ {K}_{21}+\alpha {K}_{22}& -\alpha {K}_{21}+{K}_{22}\end{array}\right]\\ =L\left[\begin{array}{cc}{I}_{gain}\mathrm{cos}({\theta}_{I})& {Q}_{gain}\mathrm{sin}({\theta}_{I})\\ {I}_{gain}\mathrm{sin}({\theta}_{I})& {Q}_{gain}\mathrm{cos}({\theta}_{I})\end{array}\right]\end{array}$$

Therefore,

$$\left({K}_{21}+\alpha {K}_{22}\right)/\left({K}_{11}+\alpha {K}_{12}\right)=\left(-\alpha {K}_{11}+{K}_{12}\right)/\left(-\alpha {K}_{21}+{K}_{22}\right)=\mathrm{sin}({\theta}_{I})/\mathrm{cos}({\theta}_{I})$$

The equation can be written as a quadratic equation to solve
for the variable *α*, that is *D _{1}α^{2}* +

$$\begin{array}{c}{D}_{1}=-{K}_{11}{K}_{12}+{K}_{22}{K}_{21}\\ {D}_{2}={K}_{12}^{2}+{K}_{21}^{2}-{K}_{11}^{2}-{K}_{22}^{2}\\ {D}_{3}={K}_{11}{K}_{12}-{K}_{21}{K}_{22}\end{array}$$

When |*C*| ≤ 1,
the quadratic equation has the following solution:

$$\alpha =\frac{-{D}_{2}-\sqrt{{D}^{2}-4{D}_{1}{D}_{3}}}{2{D}_{1}}$$

Otherwise, when |*C*| >
1, the solution has the following form:

$$\alpha =\frac{-{D}_{2}+\sqrt{{D}^{2}-4{D}_{1}{D}_{3}}}{2{D}_{1}}$$

Finally, the amplitude imbalance, *A _{Imb}*,
and the phase imbalance,

$$\begin{array}{c}{K}^{\prime}=K\left[\begin{array}{cc}1& -\alpha \\ \alpha & 1\end{array}\right]\\ {A}_{Imb}=20{\mathrm{log}}_{10}\left({{K}^{\prime}}_{11}/{{K}^{\prime}}_{22}\right)\\ {\Phi}_{Imb}=-2{\mathrm{tan}}^{-1}\left({{K}^{\prime}}_{21}/{{K}^{\prime}}_{11}\right)\left(180/\pi \right)\end{array}$$

If

*C*is real and |*C*| ≤ 1, the phase imbalance is 0 and the amplitude imbalance is 20log_{10}((1–*C*)/(1+*C*))If

*C*is real and |*C*| > 1, the phase imbalance is 180° and the amplitude imbalance is 20log_{10}((*C*+1)/(*C*−1)).If

*C*is imaginary,*A*= 0._{Imb}

Generate C and C++ code using MATLAB® Coder™.

A modified version of this example exists on your system. Do you want to open this version instead?

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web siteYou can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

- América Latina (Español)
- Canada (English)
- United States (English)

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)