Home of RF and Wireless Vendors and Resources

One Stop For Your RF and Wireless Need

MIMO MATLAB Code

This section of MATLAB source code covers MIMO basics and MIMO MATLAB code for STBC 2T1R and 2T2R configurations.

MIMO STBC STBC 2T1R MATLAB Code

MIMO STBC 2T1R
%code:Alamouti code 2T1R MIMO STBC
clc;
clear all;
close all;
ndata=2; % number of randam data
x=randint(ndata,1,1); % input data generated
x=[1 2];
%y=[x];

%INPUT DATA BITS

Data_input_bit(1,1)=x(1,1)
Data_input_bit(1,2)=x(1,2)
figure;plot(Data_input_bit);title('input data bits');
%performing 4 qam modulation on the input data
z=qammod(Data_input_bit,4);


%CHANNEL COEFFICENTS MATRIX

h=[0.3 -.2];
%h11=1; h12=1; h21=1; h22=1;

%NOISE COEFFICENTS
e=[.1 .1];
%e11=1; e12=1; e21=1; e22=1;

out=zeros(10,1);

for i=1;%:ndata-1;

% Symbols at time period T;
out(i,1)=z(i);
out(i+1,1)=z(i+1);

% Symbols at time period T+1;

out(i,2)=-conj(z(i+1));
out(i+1,2)=conj(z(i));
%time_t2(i,1)=-conj(z(i+1));
%time_t2(i+1,1)=conj(z(i));
end

s1=out(i,1);
s2=out(i+1,1);
%for j=1:100
for i=1;

%Recieved data by RX1 Antenna at time interval T
r(1,1)= (h(1,1)*s1) + (h(1,2)*s2) + e(1,1);

%Recieved data by RX1 Antenna at time interval (T+1)
r(1,2)= ((-h(1,1))*conj(s2)) + (h(1,2)*conj(s1)) + e(1,2);

end


t(1,1)=((conj(h(1,1))*r(1,1)));
t(1,2)=h(1,2)*(conj(r(1,2)));
t(2,1)=((conj(h(1,2)))*r(1,1));
t(2,2)=((h(1,1)*(conj(r(1,2)))));



%Maximum Likelehhod Detection Scehme
s1_e =t(1,1) + t(1,2);
s2_e= t(2,1) - t(2,2);
%s1_e= ((conj(h(1,1))*r(1,1))) + ((h(1,2)*(conj(r(1,2)))+ );
%s2_e= (((conj(h(2,1)))*r(2,1)) + ((h(1,2)*(conj(r(2,2))));
%performing 4 QAM Demodulation
%final output bits
final_output_Bits(1,1)=qamdemod(s1_e,4)
final_output_Bits(1,2)=qamdemod(s2_e,4)
figure;plot(final_output_Bits);title('final output Bits');

MIMO STBC 2T2R MATLAB Code

MIMO STBC 2T2R
%code:Alamouti code 2T2R MIMO STBC
clc;
clear all;
close all;
ndata=2; % number of randam data
x=randint(ndata,1,1); % input data generated
x=[2 3];
%y=[x];

%INPUT DATA BITS

Data_input_bit(1,1)=x(1,1)
Data_input_bit(1,2)=x(1,2)

%performing 16 qam modulation on the input data
z=qammod(Data_input_bit,4);


%CHANNEL COEFFICENTS MATRIX

h=[0.3 -.2 ;.1 .11];
%h11=1; h12=1; h21=1; h22=1;

%NOISE COEFFICENTS
e=[.1 .1;.1 .1];
%e11=1; e12=1; e21=1; e22=1;

out=zeros(10,1);
for i=1;%:ndata-1;

% Symbols at time period T;
out(i,1)=z(i);
out(i+1,1)=z(i+1);

% Symbols at time period T+1;

out(i,2)=-conj(z(i+1));
out(i+1,2)=conj(z(i));
%time_t2(i,1)=-conj(z(i+1));
%time_t2(i+1,1)=conj(z(i));
end

s1=out(i,1);
s2=out(i+1,1);
%for j=1:100
for i=1;

%Recieved data by RX1 Antenna at time interval T
r(1,1)= (h(1,1)*s1) + (h(1,2)*s2) + e(1,1);

%Recieved data by RX1 Antenna at time interval (T+1)
r(1,2)= ((-h(1,1))*conj(s2)) + (h(1,2)*conj(s1)) + e(1,2);

%Recieved data by RX2 Antenna at time interval T
r(2,1)= (h(2,1)*s1) + (h(2,2)*s2) + e(2,1);

%Recieved data by RX1 Antenna at time interval (T+1)
r(2,2)= ((-h(2,1))*conj(s2)) + (h(2,2)*conj(s1)) + e(2,2);
end


t(1,1)=((conj(h(1,1))*r(1,1)));
t(1,2)=h(1,2)*(conj(r(1,2)));
t(2,1)=((conj(h(2,1)))*r(2,1));
t(2,2)=((h(1,2)*(conj(r(2,2)))));

c(1,1)= ((conj(h(1,2)))*r(1,1));
c(1,2)= h(1,1)*(conj(r(1,2)));
c(2,1)= ((conj(h(2,2)))*r(2,1));
c(2,2)= ((h(2,1)*(conj(r(2,2)))));

%Maximum Likelehhod Detection Scehme
s1_e =t(1,1) + t(1,2) + t(2,1) + t(2,2);
s2_e= c(1,1) - c(1,2) + c(2,1) - c(2,2);
%s1_e= ((conj(h(1,1))*r(1,1))) + ((h(1,2)*(conj(r(1,2)))+ ((conj(h(2,1)))*r(2,1)) + ((h(1,2)*(conj(r(2,2)))));
%s2_e= ((conj(h(1,2)))*r(1,1)) - ((h(1,1)*(conj(r(1,2)))) + ((conj(h(2,2)))*r(2,1)) - ((h(2,1)*(conj(r(2,2)))));

%performing 16 QAM Demodulation
%final output bits
final_output_Bits(1,1)=qamdemod(s1_e,4)
final_output_Bits(1,2)=qamdemod(s2_e,4)

Download MATLAB codes for MIMO,SISO,SIMO,MISO

DOWNLOAD MIMO
DOWNLOAD SISO
DOWNLOAD SIMO
DOWNLOAD MISO

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 


Share this page

Translate this page