Beamforming matlab code | Beamforming QAM matlab source code

This page of MATLAB source code covers Beamforming matlab code. The output plots and mathematical equations of Beamforming QAM modulation matlab code are mentioned. QAM modulation stands for Quadrature Amplitude Modulation.

Beamforming is the technique used to boost the vector signal before transmission with the help of multiple antenna array. It helps in increasing coverage of cell tower to reach farthest mobile subscribers. Following are the main types of beamforming techniques.
• Analog Beamforming
• Digital Beamforming
• Hybrid Beamforming

analog beamforming transmitter

Figure-1 depicts analog beamforming transmitter block diagram. Refer Analog Beamforming versus Digital Beamforming basics>> and Hybrid Beamforming basics and types>>.

Beamforming matlab code

N = 10^6
nTx = 2;
k = sqrt(1/((2/3)*(M-1)));
m = [1:sqrt(M)/2];
alphaMqam = [-(2*m-1) 2*m-1];
Eb_N0_dB = [0:30];
ipHat1 = zeros(1,N);
ipHat2 = zeros(1,N);
for ii = 1:length(Eb_N0_dB)
ip = randsrc(1,N,alphaMqam) + j*randsrc(1,N,alphaMqam);
s = k*ip; % normalization of energy to 1
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white guassian noise, 0dB variance
h = 1/sqrt(2)*[randn(nTx,N) + j*randn(nTx,N)]; % Rayleigh channel
sr = (1/sqrt(nTx))*kron(ones(nTx,1),s);
% Channel and noise Noise addition
h_tx = h.*exp(-j*angle(h));
y1 = sum(h.*sr,1) + 10^(-Eb_N0_dB(ii)/20)*n;
y2 = sum(h_tx.*sr,1) + 10^(-Eb_N0_dB(ii)/20)*n;
y1Hat = y1./sum(h,1);
y2Hat = y2./sum(h_tx,1);
% demodulation
y_re1 = real(y1Hat)/k; % real part
y_im1 = imag(y1Hat)/k;
y_re2 = real(y2Hat)/k; % real part
y_im2 = imag(y2Hat)/k; % imaginary part
ipHat_re1 = 2*floor(y_re1/2)+1;
ipHat_re1(find(ipHat_re1>max(alphaMqam))) = max(alphaMqam);
ipHat_re1(find(ipHat_re1<min(alphaMqam))) = min(alphaMqam);
ipHat_re2 = 2*floor(y_re2/2)+1;
ipHat_re2(find(ipHat_re2>max(alphaMqam))) = max(alphaMqam);
ipHat_re2(find(ipHat_re2<min(alphaMqam))) = min(alphaMqam);
ipHat_im1 = 2*floor(y_im1/2)+1;
ipHat_im1(find(ipHat_im1>max(alphaMqam))) = max(alphaMqam);
ipHat_im1(find(ipHat_im1<min(alphaMqam))) = min(alphaMqam);

ipHat_im2 = 2*floor(y_im2/2)+1;
ipHat_im2(find(ipHat_im2>max(alphaMqam))) = max(alphaMqam);
ipHat_im2(find(ipHat_im2<min(alphaMqam))) = min(alphaMqam);
ipHat1 = ipHat_re1 + j*ipHat_im1;
nErr1(ii) = size(find([ip- ipHat1]),2); % counting the number of errors
ipHat2 = ipHat_re2 + j*ipHat_im2;
nErr2(ii) = size(find([ip- ipHat2]),2); % counting the number of errors
simBer1 = nErr1/N; % simulated ber (no beam forming)
simBer2 = nErr2/N; % simulated ber (with beam forming)
theoryBerAWGN = 0.5*erfc(sqrt(10.^(Eb_N0_dB/10))); % theoretical ber
EbN0Lin = 10.^(Eb_N0_dB/10);
theoryBer = 0.5.*(1-sqrt(EbN0Lin./(EbN0Lin+1)));
p = 1/2 - 1/2*(1+1./EbN0Lin).^(-1/2);
theoryBer_nRx2 = p.^2.*(1+2*(1-p));
close all
hold on
axis([0 35 10^-5 0.5])
grid on
legend('2Tx-1Rx (no Beamforming-sim)','2Tx-1Rx (Beamforming-sim)');
xlabel('Eb/No, dB');
ylabel('Bit Error Rate');
title('BER for QAM modulation in Rayleigh Fading channel');

Input and Output of Beamforming QAM matlab source code

Run the downloaded BeamformingQAM.m file after unzipping the folder. We will get output matlab image as follows.

Beamforming QAM matlab code output

DOWNLOAD Beamforming matlab code .m file

Download Beamforming QAM rar file containing matlab file>>.

Useful Links to MATLAB codes

Refer following as well as links mentioned on left side panel for useful MATLAB codes.
OFDM Preamble generation  Time off estimation corr  Freq off estimation corr  channel estimation  11a WLAN channel  PN sequence generation  OFDMA Tx Rx  AES DES  carrier aggregation  CCDF  FIR Filter  IIR Filter  Low Pass FIR  Viterbi decoder  CRC8 CRC32 

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR