# diagbfweights

Diagonalize MIMO channel

## Syntax

## Description

`[___] = diagbfweights(`

also specifies the noise distribution, `chanmat`

,`Pt`

, `Pn`

,`powdistoption`

)`powdistoption`

, across
all transmitting antennas.

## Examples

### Compute and Diagonalize Channel Matrix

Compute the channel matrix for a 4-by-4 transmitting URA array and a 5-by-5 receiving URA array. Assume that three scatterers are randomly located within a specified angular range. The element spacing for both arrays is one-half wavelength. The receive array is 500 wavelengths away from the transmitting array along the *x*-axis. Constrain the angular span for the transmitting and receiving arrays. Diagonalize the channel matrix to compute the precoding and combining weights.

Specify the 4-by-4 transmitting array. Element spacing is in units of wavelength.

Nt = 4; sp = 0.5; ygridtx = (0:Nt-1)*sp - (Nt-1)/2*sp; zgridtx = (0:Nt-1)*sp - (Nt-1)/2*sp; [ytx,ztx] = meshgrid(ygridtx,zgridtx); txpos = [zeros(1,Nt*Nt);ytx(:).';ztx(:).'];

Specify the 5-by-5 receiving array. Element spacing is in units of wavelength.

Nr = 5; sp = 0.5; ygridrx = (0:Nr-1)*sp - (Nr-1)/2*sp; zgridrx = (0:Nr-1)*sp - (Nr-1)/2*sp; [yrx,zrx] = meshgrid(ygridrx,zgridrx); rxpos = [500*ones(1,Nr*Nr);yrx(:).';zrx(:).'];

Set the angular limits for transmitting and receiving.

The azimuth angle limits for the transmitter are −45° to +45°.

The azimuth angle limits for the receiver are −75° to +50°.

The elevation angle limits for the transmitter are −12° to +12°.

The elevation angle limits for the receiver are −30° to +30°.

angrange = [-45 45 -75 50; -12 12 -30 30];

Specify three scatterers and create the channel matrix.

numscat = 3; chmat = scatteringchanmtx(txpos,rxpos,numscat,angrange);

Diagonalize the channel matrix.

[wp,wc] = diagbfweights(chmat); z = wp*chmat*wc;

Show the first four diagonal elements.

z(1:4,1:4)

`ans = `*4×4 complex*
23.3713 - 0.0000i -0.0000 - 0.0000i -0.0000 + 0.0000i -0.0000 + 0.0000i
0.0000 - 0.0000i 10.7803 + 0.0000i -0.0000 + 0.0000i 0.0000 + 0.0000i
-0.0000 - 0.0000i -0.0000 + 0.0000i 1.0566 + 0.0000i -0.0000 - 0.0000i
-0.0000 - 0.0000i 0.0000 + 0.0000i 0.0000 - 0.0000i 0.0000 + 0.0000i

### Distributed Power of Diagonalized Channel Matrix

Compute the channel matrix for a 4-by-4 transmitting URA array and a 5-by-5 receiving URA array. Assume that three scatterers are randomly located within a specified angular range. The element spacings for both arrays is one-half wavelength. The receive array is 500 wavelengths away along the *x*-axis. Diagonalize the channel matrix to compute the precoding and combining weights and the distributed power.

Specify the 4-by-4 transmitting array. Element spacing is in units of wavelength.

Nt = 4; sp = 0.5; ygridtx = (0:Nt-1)*sp - (Nt-1)/2*sp; zgridtx = (0:Nt-1)*sp - (Nt-1)/2*sp; [ytx,ztx] = meshgrid(ygridtx,zgridtx); txpos = [zeros(1,Nt*Nt);ytx(:).';ztx(:).'];

Specify the 5-by-5 receiving array. Element spacing is in units of wavelength.

Nr = 5; sp = 0.5; ygridrx = (0:Nr-1)*sp - (Nr-1)/2*sp; zgridrx = (0:Nr-1)*sp - (Nr-1)/2*sp; [yrx,zrx] = meshgrid(ygridrx,zgridrx); rxpos = [500*ones(1,Nr*Nr);yrx(:).';zrx(:).'];

Set the angular limits for transmitting and receiving.

The azimuth angle limits for the transmitter are −45° to +45°.

The azimuth angle limits for the receiver are −75° to +50°.

The elevation angle limits for the transmitter are −12° to +12°.

The elevation angle limits for the receiver are −30° to +30°.

angrange = [-45 45 -75 50; -12 12 -30 30];

Specify three scatterers and create the channel matrix.

numscat = 3; chmat = scatteringchanmtx(txpos,rxpos,numscat,angrange);

Diagonalize the channel matrix and return the distributed power.

[wp,wc,P] = diagbfweights(chmat); disp(P.')

0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625 0.0625

### Subchannel Gains of Diagonalized Channel Matrix

Compute the channel matrix for an 11-element transmitting ULA array and a 7-element receiving ULA array. Assume that there are five randomly located scatterers. The element spacings for both arrays is one-half wavelength. The receive array is 500 wavelengths away from the transmit array along the *x*-axis. Diagonalize the channel matrix to compute the precoding and combining weights, the distributed power, and the subchannel gains.

Specify the 11-element transmitting ULA array. Element spacing is in units of wavelength.

Nt = 11; sp = 0.5; txpos = (0:Nt-1)*sp - (Nt-1)/2*sp;

Specify the 7-element receiving ULA array. Element spacing is in units of wavelength.

Nr = 7; sp = 0.5; rxpos = (0:Nr-1)*sp - (Nr-1)/2*sp; numscat = 5; chmat = scatteringchanmtx(txpos,rxpos,numscat);

Diagonalize the channel matrix and return the subchannel gains.

[wp,wc,P,G] = diagbfweights(chmat); disp(G.')

221.8345 56.8443 47.6711 0.8143 0.0000 0.0000 0.0000

### Channel Capacity Sum of Diagonalized Channel Matrix

Compute the channel matrix for an 11-element transmitting ULA array and a 7-element receiving ULA array. Assume that there are five randomly located scatterers. The element spacings for both arrays is one-half wavelength. The receive array is 500 wavelengths away from the transmitting array along the *x*-axis. Create a channel matrix with two subcarriers. Diagonalize the channel matrix to compute the precoding and combining weights, the distributed power, the subchannel gains, and the channel capacity sum.

Specify the 11-element transmitting ULA array. Element spacing is in units of wavelength.

Nt = 11; sp = 0.5; txpos = (0:Nt-1)*sp - (Nt-1)/2*sp;

Specify the 7-element receiving ULA array. Element spacing is in units of wavelength.

Nr = 7; sp = 0.5; rxpos = (0:Nr-1)*sp - (Nr-1)/2*sp; numscat = 5;

Create two subcarriers.

chmat1 = scatteringchanmtx(txpos,rxpos,numscat); chmat2 = scatteringchanmtx(txpos,rxpos,numscat); chmat(1,:,:) = chmat1; chmat(2,:,:) = chmat2;

Diagonalize the channel matrix and return the subchannel gains.

[wp,wc,P,G,C] = diagbfweights(chmat); disp(C.')

9.5466 9.3605

### Diagonalize Channel Matrix with Specified Power

Compute the channel matrix for an 11-element transmitting ULA array and a 7-element receiving ULA array. Specify the total transmitted power at 1000. Assume that there are five randomly located scatterers. The element spacings for both arrays is one-half wavelength. The receive array is 500 wavelengths away from the transmitting array along the *x*-axis. Create a channel matrix with two subcarriers. Diagonalize the channel matrix to compute the precoding and combining weights, the distributed power, the subchannel gains, and the channel capacity sum.

Specify the 11-element transmitting ULA array. Element spacing is in units of wavelength.

Nt = 11; sp = 0.5; txpos = (0:Nt-1)*sp - (Nt-1)/2*sp;

Specify the 7-element receiving ULA array. Element spacing is in units of wavelength.

Nr = 7; sp = 0.5; rxpos = (0:Nr-1)*sp - (Nr-1)/2*sp; numscat = 5;

Create two subcarriers.

chmat1 = scatteringchanmtx(txpos,rxpos,numscat); chmat2 = scatteringchanmtx(txpos,rxpos,numscat); chmat(1,:,:) = chmat1; chmat(2,:,:) = chmat2;

Diagonalize the channel matrix and return the distributed power for both subcarriers.

Pt = 1000.0; [wp,wc,P,G,C] = diagbfweights(chmat,Pt); disp(P.')

90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091 90.9091

### Diagonalize Channel Matrix with Specified Noise Power

Compute the channel matrix for an 11-element transmitting ULA array and a 7-element receiving ULA array. Specify the total transmitted power at 1000 and the transmitting antenna noise power at 100. Assume that there are five randomly located scatterers. The element spacings for both arrays is one-half wavelength. The receive array is 500 wavelengths away from the transmit array along the *x*-axis. Create a channel matrix with two subcarriers. Diagonalize the channel matrix to compute the precoding and combining weights, the distributed power, subchannel gains, and channel capacity sum.

Specify the 11-element transmitting ULA array. Element spacing is in units of wavelength.

Nt = 11; sp = 0.5; txpos = (0:Nt-1)*sp - (Nt-1)/2*sp;

Specify the 7-element receiving ULA array. Element spacing is in units of wavelength.

Nr = 7; sp = 0.5; rxpos = (0:Nr-1)*sp - (Nr-1)/2*sp; numscat = 5;

Create two subcarriers.

chmat1 = scatteringchanmtx(txpos,rxpos,numscat); chmat2 = scatteringchanmtx(txpos,rxpos,numscat); chmat(1,:,:) = chmat1; chmat(2,:,:) = chmat2;

Diagonalize the channel matrix and return the gain for both subcarriers.

Pt = 1000.0; Pn = 100.0; [wp,wc,P,G,C] = diagbfweights(chmat,Pt,Pn); disp(G.')

221.8345 119.7549 56.8443 115.9814 47.6711 24.9780 0.8143 5.1025 0.0000 0.0059 0.0000 0.0000 0.0000 0.0000

### Diagonalize Channel Matrix Using Waterfill Power Distribution

Compute the channel matrix for an 11-element transmitting ULA array and a 7-element receiving ULA array. Specify the total transmitted power at 1000 and the transmitting antenna noise power at 100. Specify the transmitted power distribution as `'Waterfill'`

. Assume that there are five randomly located scatterers. The element spacing for both arrays is one-half wavelength. The receive array is 500 wavelengths away from the transmitting array along the *x*-axis. Create a channel matrix with two subcarriers. Diagonalize the channel matrix to compute the precoding and combining weights, the distributed power, the subchannel gains, and the channel capacity sum.

Specify the 11-element transmitting ULA array. Element spacing is in units of wavelength.

Nt = 11; sp = 0.5; txpos = (0:Nt-1)*sp - (Nt-1)/2*sp;

Specify the 7-element receiving ULA array. Element spacing is in units of wavelength.

Nr = 7; sp = 0.5; rxpos = (0:Nr-1)*sp - (Nr-1)/2*sp; numscat = 5;

Create two subcarriers.

Diagonalize the channel matrix and return the gain for both subcarriers.

```
Pt = 1000.0;
Pn = 100.0;
[wp,wc,P,G,C] = diagbfweights(chmat,Pt,Pn,'Waterfill');
disp(G.')
```

221.8345 119.7549 56.8443 115.9814 47.6711 24.9780 0.8143 5.1025 0.0000 0.0059 0.0000 0.0000 0.0000 0.0000

## Input Arguments

`chanmat`

— Channel response matrix

*N*_{t}-by-*N*_{r} complex-valued
matrix | *L*-by-*N*_{t}-by-*N*_{r} complex-valued MATLAB^{®} array

_{t}

_{r}

_{t}

_{r}

Channel response matrix, specified as an *N _{t}*-by-

*N*complex-valued matrix or an

_{r}*L*-by-

*N*-by-

_{t}*N*complex-valued MATLAB array.

_{r}*N*is the number of elements in the transmitting array._{t}*N*is the number of elements in the receiving array._{r}*L*is the number of subcarriers.

When `chanmat`

is a MATLAB array
containing subcarriers, each subcarrier is decomposed independently
into subchannels.

**Data Types: **`double`

| `single`

**Complex Number Support: **Yes

`Pt`

— Total transmit power

`1`

(default) | positive scalar | *L*-element vector of positive values

Total transmit power, specified as a positive scalar or an *L*-element
vector of positive values. `Pt`

has the same units
as the total distributed power, `P`

.

**Data Types: **`double`

| `single`

`Pn`

— Noise power

`1`

(default) | positive scalar

Noise power in each receiving antenna, specified as a positive
scalar. `Pn`

has the same units as the total transmit
power, `Pt`

.

**Data Types: **`double`

| `single`

`powdistoption`

— Power distribution option

`'Uniform'`

(default) | `'Waterfill'`

Power distribution option, specified as `'Uniform'`

or `'Waterfill'`

.
When `powdistoption`

is `'Uniform'`

,
the transmit power is evenly distributed across all *N _{t}* channels.
If

`powdistoption`

is `'Waterfill'`

,
the transmit power is distributed across the *N*channels using a waterfill algorithm.

_{t}**Data Types: **`char`

## Output Arguments

`wp`

— Precoding weights

*N*_{t}-by-*N*_{t} complex-valued
matrix | *L*-by-*N*_{t}-by-*N*_{t} complex-valued MATLAB array

_{t}

_{t}

_{t}

_{t}

Precoding weights, returned as an *N _{t}*-by-

*N*complex-valued matrix or an

_{t}*L*-by-

*N*-by-

_{t}*N*complex-valued MATLAB array. Units are dimensionless.

_{t}**Data Types: **`double`

| `single`

**Complex Number Support: **Yes

`wc`

— Combining weights

*N*_{r}-by-*N*_{r} complex-valued
matrix | *L*-by-*N*_{r}-by-*N*_{r} complex-valued MATLAB array

_{r}

_{r}

_{r}

_{r}

Combining weights, returned as an *N _{r}*-by-

*N*complex-valued matrix or an

_{r}*L*-by-

*N*-by-

_{r}*N*complex-valued MATLAB array. Units are dimensionless.

_{r}**Data Types: **`double`

| `single`

**Complex Number Support: **Yes

`P`

— Distributed power

1-by-*N*_{t} real-valued
row vector | *L*-by-*N*_{t} real-valued
matrix

_{t}

_{t}

Distributed power, returned as a vector or matrix.

When

`chanmat`

is an*N*-by-_{t}*N*real-valued matrix,_{r}`P`

is a 1-by-*N*real-valued row vector._{t}When

`chanmat`

is an*L*-by-*N*-by-_{t}*N*real-valued MATLAB array,_{r}`P`

is an*L*-by-*N*real-valued matrix._{t}

Power units are linear.

**Data Types: **`double`

| `single`

`G`

— Subchannel gains

1-by-*N*_{g} complex-valued
row vector | *L*-by-*N*_{g} complex-valued
matrix

_{g}

_{g}

Subchannel gains, returned as a vector or matrix.

When

`chanmat`

is an*N*-by-_{t}*N*complex-valued matrix,_{r}`G`

is a 1-by-*N*complex-valued row vector._{g}When

`chanmat`

is an*L*-by-*N*-by-_{t}*N*complex-valued MATLAB array,_{r}`G`

is an*L*-by-*N*complex-valued matrix._{g}

*N _{g}* is the
smaller of

*N*and

_{t}*N*.

_{r}Gain units are linear.

**Data Types: **`double`

| `single`

**Complex Number Support: **Yes

`C`

— Channel capacity sum for each subcarrier

scalar | *L*-by-1 vector

Channel capacity sum for each subcarrier, returned as a scalar or vector.

When

`chanmat`

is an*N*-by-_{t}*N*complex-valued matrix,_{r}`C`

is a scalar.When

`chanmat`

is an*L*-by-*N*-by-_{t}*N*complex-valued MATLAB array,_{r}`C`

is an*L*-by-1 vector.

Capacity units are in bps/Hz.

**Data Types: **`double`

| `single`

**Complex Number Support: **Yes

## References

[1] Heath, R. Jr. et al. “An Overview of Signal Processing Techniques for Millimeter Wave MIMO Systems”, arXiv.org:1512.03007 [cs.IT], 2015.

[2] Tse, D. and P. Viswanath, *Fundamentals of
Wireless Communications*, Cambridge: Cambridge University
Press, 2005.

[3] Paulraj, A. *Introduction to Space-Time Wireless
Communications*, Cambridge: Cambridge University Press,
2003.

## Extended Capabilities

### C/C++ Code Generation

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

Usage notes and limitations:

Does not support variable-size inputs.

## Version History

**Introduced in R2017a**

## See Also

### Functions

### Objects

## Commande MATLAB

Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :

Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.

Select a Web Site

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: .

You can also select a web site from the following list:

## How to Get Best Site Performance

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

### Americas

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

### Europe

- 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)