• 大小: 1KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-04-17
  • 语言: Matlab
  • 标签: sm  ml  qam  

资源简介

4 QAM Spatial modulation with maximum likehood detection

资源截图

代码片段和文件信息

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]1N) ;    % generating stream of bits

x=vec2mat(i3);          % grouping generated bits into 3

s=kron(symbol_setones(nRx1));   % grouping symbols into matrix
s=repmat(s[1 nTx]);
xTransmit=zeros(symbol_sizenTx);                                                             
xDemod=zeros(symbol_size3);                                                                  

antenna_symbol=zeros(N/31);    
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(nRxnTx))+ 1i*(randn(nRxnTx));    % rayleigh channel
        
        n=1/sqrt(2)*(randn(nRx1))+1i*(randn(nRx1));            % noise
        
    H=kron(ones(symbolset_size1)h);      
      sD= H.*s;
      
            xTransmit(jjantenna_symbol(jj1)) =antenna_symbol(jj2) ;             % Assign Symbol and Antenna Index
            xTransmit2=kron(xTransmit(jj:)ones(nRx1));
            
            y = sum(xTransmit2.*h2) +10^(-Eb_No_Db(ii)/20)*n;
            
            y2=kron(ones(symbolset_size1)y);                                                  % Copy for Symbol set
            y2=repmat(y21nRx);                                                            % Copy for Antenna
            y2=abs(y2-sD);

            z=zeros(symbolset_sizenTx);
            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(jj1)=antennabits(c);
            
            xDemod(jj2: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_DbsimBER‘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‘)


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2498  2014-05-17 01:18  SM_4QAM_ML.m

----------- ---------  ---------- -----  ----

                 2498                    1


评论

共有 条评论