Friday, June 9, 2023
HomeMatlabSteer Beams to Actuality: from Phased Array to Beamforming » Scholar Lounge

Steer Beams to Actuality: from Phased Array to Beamforming » Scholar Lounge

In immediately’s submit, Liping from the Scholar Packages Staff will share her expertise on how MATLAB and Simulink may help college students to know wi-fi communication theories on beamforming and precoding. Allow us to see what she goes to share.

Once I took the course “Fundamentals of Wi-fi Communications”, I felt it was so laborious to pay attention within the courses because the course materials was stuffed with arithmetic together with matrices, stochastic processes, formulation derivations, and so forth. After engaged on wi-fi communication techniques corresponding to LTE and 5G for a few years, I discovered understanding the essential ideas and theories was so vital since they’re elementary to completely different functions.

Many examples and reference functions in MATLAB may help you to know complicated wi-fi communication theories. On this script, I’ll present how a demo may help you to know beamforming, a method that has been broadly utilized in 5G and even in 6G, radar, sonar, medical imaging, and audio array techniques.

What are Phased Arrays?

To grasp beamforming, you first have to know what beams are and the way they’re shaped. Briefly, a beam sample could be shaped by a phased array, which refers to a number of parts that may measure or emit waves. The weather are organized in some configuration and act collectively to provide a desired beam sample. You may steer the beams by adjusting the part of the indicators to every ingredient with out bodily transferring the array. For extra particulars, please watch Brian Douglas’ video “What are Phased Arrays?“, the place he makes use of numerous animations to clarify the idea.

In wi-fi communications, the weather of a phased array may very well be antennas. From the snapshots beneath of Douglas’ video, you’ll be able to see in the proper determine that the beams of a Uniform Linear Array (ULA) of isotropic antennas, the place indicators from every antenna have been superimposed so the sign power has been enhanced in some instructions, whereas they’ve been canceled within the different instructions.


The beam sample of an antenna array is dependent upon the settings together with the variety of antenna parts, spacing between parts, array geometry in addition to particular person antenna patterns.

The Sensor Array Analyzer App in MATLAB offers you with an interactive software to arrange an antenna array, get its primary efficiency traits, and visualize its beam sample in a 2D or 3D house. After putting in the Phased Array Toolbox in MATLAB, yow will discover the Sensor Array Analyzer by going to the App Tab within the MATLAB Toolstrip, adopted by looking out beneath ‘Sign Processing and Communications’. You can also open the App with the next command within the MATLAB Command Window.

When wanting by means of the next instance on the best way to use the Sensor Array Analyzer, you discover the App may help with tuning parameters, visualizing the beam sample of a phased array, in addition to steering a phased array to a sure path. With completely different steering vectors, you’ll be able to transfer beams round with out transferring the array bodily.


Now you should still be interested by the best way to use beam steering to enhance the efficiency of a wi-fi communication system. The reply is by beamforming, a scheme to pre-steer beams to a desired path! The subsequent instance will present you the best way to do beamforming of an antenna array to enhance the Sign-to-Noise Ratio (SNR) of a wi-fi hyperlink.

Easy methods to do Beamforming?

Antenna arrays have develop into a part of the usual configuration in 5G. Such wi-fi communication techniques are also known as A number of-Enter-and-A number of-Output (MIMO) techniques. To indicate the benefits of a number of antennas, we assume a wi-fi hyperlink deployed at 60 GHz, a millimeter wave frequency that had been newly thought of in 5G.

rng(0); % set the seed of the random quantity generator

c = 3e8; % propagation velocity

fc = 60e9; % service frequency

lambda = c/fc; % wavelength

With no loss in generality, we place a transmitter on the origin and a receiver roughly 1.6 km away.

txcenter = [0;0;0]; % middle of the transmitter

rxcenter = [1500;500;0]; % middle of the receiver

Then the Angle of Departure (AoD) and the Angle of Arrival (AoA) could be calculated based mostly on the middle places of the transmitter and the receiver.

[~,txang] = rangeangle(rxcenter,txcenter); % AoD

[~,rxang] = rangeangle(txcenter,rxcenter); % AoA

Subsequent, we contemplate two representive channel varieties.

Line-of-Sight Channel

Line-of-Sight (LOS) propagation is the best wi-fi channel that usually occurred in rural areas. Does adopting an antenna array beneath LOS propagation can improve the SNR on the receiver and thus enhance the hyperlink’s bit error fee (BER)?

As a benchmark, you would simulate the BER efficiency of a Single-Enter-and-Single-output (SISO) hyperlink beneath a LOS channel as follows, the place the scatteringchanmtx operate is used to create a channel matrix for various transmit and obtain array configurations. The operate simulates a number of scatterers between the transmit and the obtain arrays assuming the sign travels from the transmit array to all of the scatterers first after which bounces off the scatterers and arrives on the obtain array. On this case, every scatterer defines a sign path between the transmit and the obtain array, so the ensuing channel matrix describes a multipath atmosphere. You may learn the main points of this operate by deciding on it after which right-clicking to open the operate.

Take into account a SISO communication hyperlink the place each the transmitter and the receiver solely have a single antenna positioned on the node middle, and there’s a direct path from the transmitter to the receiver. Such a LOS channel could be modeled as a particular case of a multipath atmosphere.

txsipos = [0;0;0]; % antenna place to the transmitter

rxsopos = [0;0;0]; % antenna place to the receiver

sisochan = scatteringchanmtx(txsipos,rxsopos,txang,rxang,g); % generate a SISO LOS channel

Nsamp = 1e6; % pattern fee

x = randi([0 1],Nsamp,1); % information supply

ebn0_param = -10:2:10; % SNRs, unit in dB

Nsnr = numel(ebn0_param); % whole variety of SNRs

ber_siso = helperMIMOBER(sisochan,x,ebn0_param)/Nsamp; % caculate the bit error fee (BER)

You’ve got the BER efficiency of a SISO LOS hyperlink. When wanting into the main points of the helperMIMOBER operate given within the Helper Capabilities session on the finish of this script, it’s best to discover BPSK modulation is taken into account in all of the instances.

Now contemplate a MIMO hyperlink. we assume each the transmitter and the receiver are 4-element ULAs with half-wavelength spacing,

Ntx = 4; % variety of transmitting antennas

Nrx = 4; % variety of receiving antennas

txarray = phased.ULA(‘NumElements’,Ntx,‘ElementSpacing’,lambda/2); % antenna array of the transmitter

txmipos = getElementPosition(txarray)/lambda;

rxarray = phased.ULA(‘NumElements’,Nrx,‘ElementSpacing’,lambda/2); % antenna array of the receiver

rxmopos = getElementPosition(rxarray)/lambda;

With the obtain antenna array, the obtained indicators throughout array parts of the receiver are coherent, so it’s doable to pre-steer the obtain array towards the transmitter to enhance the SNR. Furthermore, the transmitter can also pre-steer the principle beam of its antenna array towards the receiver for additional enchancment.

txarraystv = phased.SteeringVector(‘SensorArray’,txarray,


rxarraystv = phased.SteeringVector(‘SensorArray’,rxarray,


wt = step(txarraystv, fc, txang)’;

wr = conj(step(rxarraystv, fc, rxang));

mimochan = scatteringchanmtx(txmipos,rxmopos,txang,rxang,g);

ber_mimo = helperMIMOBER(mimochan,x,ebn0_param,wt,wr)/Nsamp;



With beamforming, the modulated sign must be multiplied with wt earlier than sending out on the transmitter, whereas the obtained sign must be multiplied with wr earlier than demodulation on the receiver. After utilizing the helperPlotSpatialMIMOScene operate to visualise the scene within the determine above, you discover the principle beams on the transmitter and the receiver have been pointed at one another.

Now you’ll be able to examine the BER efficiency within the SISO and the MIMO instances beneath the LOS propagation channel,

helperBERPlot(ebn0_param,[ber_siso(:) ber_mimo(1,:).’]);

legend(‘SISO LOS’,‘MIMO LOS’);


The BER curve exhibits the transmit array and the obtain array contribute round 6 dB array acquire respectively, leading to a complete acquire of 12 dB over the SISO case.

Observe that the acquire is achieved beneath the belief that the transmitter must know the receiver’s path or location, and in the meantime the sign incoming path is thought to the receiver, the place the angle is usually obtained utilizing the path of arrival estimation algorithms.

Multipath Channel

Typically, wi-fi communications happen in a multipath fading atmosphere. The remainder of this instance explores how phased arrays may help in such a case.

Assume there are 10 randomly positioned scatterers within the channel, so there will probably be 10 paths from the transmitter to the receiver, as illustrated within the following.

Nscat = 10; % variety of scatterers

[~,~,scatg,scatpos] = helperComputeRandomScatterer(txcenter,rxcenter,Nscat);



For simplicity, assume that indicators touring alongside all paths arrive throughout the identical image interval, so the channel is frequency flat and never frequency selective.

In such a multipath fading channel, the channel wants to alter over a number of time slots to simulate the BER curve. Assume the simulation lasts 1000 frames and every body has 10000 bits. The BER curve of the baseline SISO hyperlink beneath a multipath channel could be simulated as follows.

Nframe = 1e3; % variety of frames

Nbitperframe = 1e4; % variety of bits per body

Nsamp = Nframe*Nbitperframe; % whole variety of information samples

x = randi([0 1],Nbitperframe,1); % generated the supply information

sisompchan = scatteringchanmtx(txsipos,rxsopos,Nscat);

wr = sisompchan’/norm(sisompchan);

nerr = nerr + helperMIMOBER(sisompchan,x,ebn0_param,1,wr);

In SISO instances, should you examine the channel matrix of a LOS channel with that of a multipath channel, you’ll be able to discover it incorporates a single ingredient and the worth of the ingredient adjustments from an actual quantity to a posh quantity resulting from multipath fading. In such a case, a combining weight calculated as wr = sisompchan’/norm(sisompchan) can be utilized on the receiver to enhance the SNR.

Within the MIMO case, the BER curve could be simulated as follows, the place the diagbfweights operate is used to calculate the precoding weight wp on the transmitter and the combining weights wc on the receiver. You may right-click on the operate and open it to see its particulars.

x = randi([0 1],Nbitperframe,Ntx);

mimompchan = scatteringchanmtx(txmipos,rxmopos,Nscat);

[wp,wc] = diagbfweights(mimompchan);

nerr = nerr + helperMIMOBER(mimompchan,x,ebn0_param,wp,wc);

To grasp how precoding and mixing weights are calculated, you first want to know what Singular Worth Decomposition (SVD) is. Use the next command to seek out the MATLAB documentation on SVD.

Briefly, an SVD ([U,S,V] = svd(X)) produces a diagonal matrix S, of the identical dimension as X and with nonnegative diagonal parts in reducing order, and unitary matrices U and V in order that X = U*S*V’. Attempt following instructions in MATLAB.

[u,s,v] = svd(mimompchan)


Evaluate bf with s, you now know the diagbfweights operate is predicated on SVD. Because of a wealthy scatterer atmosphere, the channel matrix of a MIMO multipath channel normally has full rank.

Observe that the product wp*mimompchan*wc is a diagonal matrix, which signifies that the knowledge obtained by every obtain array ingredient is just a scaled model of the transmit array ingredient. Such a MIMO multipath channel behaves like a number of orthogonal subchannels throughout the authentic channel.

Due to this fact, it’s doable to ship a number of information streams concurrently throughout the MIMO multipath channel, which known as spatial multiplexing. The fundamental concept of spatial multiplexing is to separate the channel matrix into a number of modes in order that the info stream despatched from completely different parts within the transmit array could be independently recovered from the obtained sign. The aim of spatial multiplexing is much less about rising the SNR and extra about rising the knowledge throughput.

Now you’ll be able to plot the BER curves of the SISO multipath case, and the primary two information streams within the MIMO multipath case. As a benchmark, you additionally plot the BER curve within the SISO LOS case that has been received from the earlier part.

helperBERPlot(ebn0_param,[ber_siso(:) ber_sisomp(:) ber_mimomp(1,:).’ ber_mimomp(2,:).’]);

legend(‘SISO LOS’,‘SISO Multipath’,‘MIMO Multipath Stream 1’,‘MIMO Multipath Stream 2’);


In comparison with the BER curve of the SISO LOS channel, the BER curve of the SISO multipath channel falls off a lot slower as a result of fading brought on by the multipath propagation. In the meantime, within the MIMO multipath case, the primary subchannel corresponds to the dominant transmit and obtain instructions so there isn’t a loss within the range acquire, which refers back to the acquire on the slope change. Though the second stream can’t present a acquire as excessive as the primary stream because it makes use of a much less dominant subchannel, the general data throughput could be improved since it’s now doable to transmit a number of information streams concurrently.


This demo explains how array processing can enhance the efficiency of a MIMO wi-fi communication system. Relying on the character of the channel, the arrays can be utilized to both enhance the SNR through array acquire or range acquire; or enhance the capability through spatial multiplexing.

Now you perceive some fundamentals of MIMO wi-fi communications corresponding to beamforming, precoding, range acquire, and spatial multiplexing. The helper capabilities used on this demo are connected on the finish of this script. Please run the code and attain out to us at in case you have any additional questions.

Additional Exploration

To learn to make beamforming actual in 5G, please watch the tutorial video “Beamforming for MU-MIMO in 5G New Radio“. Furthermore, numerous examples and reference functions can be found in the documentation on wi-fi communications, which may help you to know the related ideas and theories extra simply and clearly. Varied examples of AI for Wi-fi also can offer you extra reference functions on the best way to apply AI know-how in wi-fi communications. Have enjoyable!

Helper Capabilities

The primary helper operate is for plotting the MIMO scene in a 2D space.

operate helperPlotSpatialMIMOScene(txarraypos,rxarraypos,txcenter,rxcenter,scatpos,wt,wr)

rmax = norm(txcenter-rxcenter);

if measurement(txarraypos,2) == 1 && measurement(rxarraypos,2) == 1

elseif measurement(txarraypos,2) == 1

spacing_scale = rmax/20/imply(diff(rxarraypos(2,:)));

spacing_scale = rmax/20/imply(diff(txarraypos(2,:)));

txarraypos_plot = txarraypos*spacing_scale+txcenter;

rxarraypos_plot = rxarraypos*spacing_scale+rxcenter;



textual content(txcenter(1)-85,txcenter(2)-15,‘TX’);



textual content(rxcenter(1)+35,rxcenter(2)-15,‘RX’);


line([txcenter(1) rxcenter(1)],[txcenter(2) rxcenter(2)]);

hscat = plot(scatpos(1,:),scatpos(2,:),‘ro’);

for m = 1:measurement(scatpos,2)

plot([txcenter(1) scatpos(1,m)],[txcenter(2) scatpos(2,m)],‘b’);

plot([rxcenter(1) scatpos(1,m)],[rxcenter(2) scatpos(2,m)],‘b’);


txbeam = abs(wt*steervec(txarraypos,txbeam_ang)); % wt row

txbeam = txbeam/max(txbeam)*nbeam;

[txbeampos_x,txbeampos_y] = pol2cart(deg2rad(txbeam_ang),txbeam);


rxbeam_ang = [90:180 -179:-90];

rxbeam = abs(wr.’*steervec(rxarraypos,rxbeam_ang)); % wr column

rxbeam = rxbeam/max(rxbeam)*nbeam;

[rxbeampos_x,rxbeampos_y] = pol2cart(deg2rad(rxbeam_ang),rxbeam);


The second helper operate is for calculating the BER values of a MIMO hyperlink.

operate nber = helperMIMOBER(chan,x,snr_param,wt,wr)

xt = 1/sqrt(Ntx)*(2*x-1)*wt; % map to bpsk

nber = zeros(Nrx,numel(snr_param),‘like’,1); % actual

for m = 1:numel(snr_param)

n = sqrt(db2pow(-snr_param(m))/2)*(randn(Nsamp,Nrx)+1i*randn(Nsamp,Nrx));

Within the first two capabilities, a SISO scene/hyperlink could be thought of as a particular case of a MIMO scene/hyperlink.

The third operate is for calculating the place of the scatterers.

operate [txang,rxang,g,scatpos] =


ang = 90*rand(1,Nscat)+45;

ang = (2*(rand(1,numel(ang))>0.5)-1).*ang;

r = 1.5*norm(txcenter-rxcenter);

scatpos = phased.inner.ellipsepts(txcenter(1:2),rxcenter(1:2),r,ang);

scatpos = [scatpos;zeros(1,Nscat)];

[~,txang] = rangeangle(scatpos,txcenter);

[~,rxang] = rangeangle(scatpos,rxcenter);

The fourth operate is for plotting BER curves.

operate helperBERPlot(ebn0,ber)


markerparam = {‘x’,‘+’,‘^’,‘v’,‘.’};

h(m).Marker = markerparam{m};

xlabel(‘E_b/N_0 (dB)’);



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments