MimO OFDM Index modulation ( can someone provide me with matlab code for index )

Status
Not open for further replies.

syee

Newbie level 3
Joined
Feb 6, 2019
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
65
Here is matlab code for mimo -odfm ( can someone help me to change this code to have index modulation or provide me with a code for Mimo-ofdm-Index modulation)


Code Matlab M - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
clear all
close all
clc
nbits = 208000;
modlevel = 2 ;
nbitpersym  = 52;   % number of bits per qam OFDM symbol (same as the number of subcarriers for 16-qam)
nsym        = 10^4; % number of symbols
len_fft     = 64;   % fft size
sub_car     = 52;   % number of data subcarriers
totalBits = 2*nbitpersym*nsym  ; % total number of Data Bits
bitsPerBranch = nbitpersym*nsym  ; % total number of data Bits in each of the two branches
EbNo        = 0:2:15;
EsNo= EbNo+10*log10(52/64)+ 10*log10(64/80) +10*log10(4);
snr=EsNo - 10*log10((64/80));
M = modem.qammod('M',16); % modulation object
% Generating data
t_data=randint(2*nbitpersym*nsym*4,1,2);
qamdata=bi2de(reshape(t_data,4,totalBits).','left-msb');
 
maping = bin2gray(qamdata,'qam',16);
% modulating data
mod_data =1/sqrt(10)* modulate(M,maping);
 
ipMod1 = mod_data(1:bitsPerBranch); % 1st Branch Data
ipMod2 = mod_data(bitsPerBranch+1:totalBits);% 2nd Branch Data
 
% serial to parallel conversion
%par_data = reshape(mod_data,nbitpersym,nsym).';
ipMod1 =reshape(ipMod1,nbitpersym,nsym).';
ipMod2 = reshape(ipMod2,nbitpersym,nsym).';
 
 
% pilot insertion
%pilot_ins_data=[zeros(nsym,6) par_data(:,[1:nbitpersym/2]) zeros(nsym,1) par_data(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym,5)] ;
x1F =[zeros(nsym,6) ipMod1(:,[1:nbitpersym/2]) zeros(nsym,1) ipMod1(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym,5)] ;
x2F = [zeros(nsym,6) ipMod2(:,[1:nbitpersym/2]) zeros(nsym,1) ipMod2(:,[nbitpersym/2+1:nbitpersym]) zeros(nsym,5)] ;
 
 
 
% fourier transform time doamain data
IFFT_data = ifft(fftshift(x1F.')).';
a=max(max(abs(IFFT_data)));
IFFT_data=IFFT_data./a; % normalization
 
IFFT_data2 = ifft(fftshift(x2F.')).';
b=max(max(abs(IFFT_data2)));
IFFT_data2=IFFT_data2./b; % normalization
 
 
% addition cyclic prefix
cylic_add_data = [IFFT_data(:,[49:64]) IFFT_data].';
 
cylic_add_data2 = [IFFT_data2(:,[49:64]) IFFT_data2].';
% parallel to serial coversion
%ser_data = reshape(cylic_add_data,80*nsym,1);
 
ser_data = reshape(cylic_add_data,80*nsym,1);
ser_data2 = reshape(cylic_add_data2,80*nsym,1);
xt = [ser_data  , ser_data2];
 
 
% passing thru channel
no_of_error=[];
ratio=[];
for ii=1:length(snr)
  
chan_awgn = awgn(xt,snr(ii),'measured'); % awgn addition
 
y1t = chan_awgn(:,1); 
y2t = chan_awgn(:,2);
 
ser_to_para = reshape(y1t,80,nsym).'; % serial to parallel coversion
ser_to_para2 = reshape(y2t,80,nsym).'; % serial to parallel coversion
 
 
cyclic_pre_rem = ser_to_para(:,[17:80]);   %cyclic prefix removal
cyclic_pre_rem2 = ser_to_para2(:,[17:80]);   %cyclic prefix removal
 
 
FFT_recdata =a*fftshift(fft(cyclic_pre_rem.')).';    % freq domain transform
FFT_recdata2 =a*fftshift(fft(cyclic_pre_rem2.')).';    % freq domain transform
 
 
rem_pilot = FFT_recdata (:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]); %pilot removal\
rem_pilot2 = FFT_recdata2 (:,[6+[1:nbitpersym/2] 7+[nbitpersym/2+1:nbitpersym] ]); %pilot removal
 
ser_data_1 =sqrt(10)* reshape(rem_pilot.',nbitpersym*nsym,1);  % serial coversion
ser_data_12 =sqrt(10)* reshape(rem_pilot2.',nbitpersym*nsym,1);  % serial coversion
yF = [ ser_data_1 ; ser_data_12 ] ;
 
 
z=modem.qamdemod('M',16);
demod_Data = demodulate(z,yF);  %demodulatin the data
demaping = gray2bin(demod_Data,'qam',16);
data1 = de2bi(demaping,'left-msb');
data2 = reshape(data1.',2*nbitpersym*nsym*4,1);
[no_of_error(ii),ratio(ii)]=biterr(t_data , data2) ; % error rate calculation
end
% plotting the result
semilogy(EbNo,ratio,'--*r','linewidth',2);
hold on;
theoryBer = (1/4)*3/2*erfc(sqrt(4*0.1*(10.^(EbNo/10))));
semilogy(EbNo,theoryBer ,'--b','linewidth',2);
axis([0 15 10^-5 1])
legend('simulated','theoritical')
grid on
xlabel('EbNo');
ylabel('BER')
title('Bit error probability curve for qam using OFDM');

 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…