Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to simulate 16QAM Spatial Modulation by ML detection?

Status
Not open for further replies.

q0206010

Newbie level 1
Joined
May 21, 2019
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
23
I have 4QAM-Spatial Modulation matlabcode . But i need to simulate 4transmit antennas,4receive antennas 16QAM-SM By ML detection .How should i do


Code dot - [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
clc 
clear all; 
N=3*10^5;                      %number of symbol 
symbol_set=[1+1i;1-1i;1i-1;1i-1i]/sqrt(2);   %set of symbol to be transmitted 
symbolset_size=4; 
symbol_size=N/3; 
Eb_No_Db=(0:25); 
nTx=2;                              % number of transmitting antenna 
nRx=2;                              % number of receiving antenna 
antennabits=[0;1]; 
Sym_to_bit=[0 0;0 1;1 0;1 1]; 
 
i=randi([0 1],1,N) ;    % generating stream of bits 
 
x=vec2mat(i,3);          % grouping generated bits into 3 
 
s=kron(symbol_set,ones(nRx,1));   % grouping symbols into matrix 
s=repmat(s,[1 nTx]); 
xTransmit=zeros(symbol_size,nTx);                                                              
xDemod=zeros(symbol_size,3);                                                                   
 
antenna_symbol=zeros(N/3,1);     
antenna_symbol(:,1)=x(:,1)+1;       %  
antenna_symbol(:,2)=symbol_set(bi2de(x(:,2:3),'left-msb')+1) ;   %Modulate 
 
for ii=1:length(Eb_No_Db) 
     
    for jj=1:symbol_size 
        
        h=1/sqrt(2)*(randn(nRx,nTx))+ 1i*(randn(nRx,nTx));    % rayleigh channel 
         
        n=1/sqrt(2)*(randn(nRx,1))+1i*(randn(nRx,1));            % noise 
         
    H=kron(ones(symbolset_size,1),h);       
      sD= H.*s; 
       
            xTransmit(jj,antenna_symbol(jj,1)) =antenna_symbol(jj,2) ;      % Assign Symbol and Antenna Index 
            xTransmit2=kron(xTransmit(jj,:),ones(nRx,1)); 
             
            y = sum(xTransmit2.*h,2) +10^(-Eb_No_Db(ii)/20)*n; 
             
            y2=kron(ones(symbolset_size,1),y);              % Copy for Symbol set 
            y2=repmat(y2,1,nRx);             % Copy for Antenna 
            y2=abs(y2-sD); 
 
            z=zeros(symbolset_size,nTx); 
            z(1,:)=abs(sum(y2(1:2,:),1)); 
            z(2,:)=abs(sum(y2(3:4,:),1)); 
            z(3,:)=abs(sum(y2(5:6,:),1)); 
            z(4,:)=abs(sum(y2(7:8,:),1)); 
            [v r]=min(z); 
            [v c]=min(v); 
            xDemod(jj,1)=antennabits(c); 
             
            xDemod(jj,2:3)=Sym_to_bit(r(c),:); 
       
    end 
     
    nErr(ii)= size(find(i-reshape(xDemod',1,[])),2); 
end 
simBER = nErr/N; 
 
 
close all 
figure 
semilogy(Eb_No_Db,simBER,'m.-','linewidth',2); 
axis([0 20 10^-5 1]) 
grid on 
legend('Sim 4QAM'); 
xlabel('Eb/No, dB') 
ylabel('Bit Error Rate') 
title('Bit Error Prob 4QAM 2x2 (3 Bit) with SM in Rayleigh Fading')

 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top