⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stbc21_16qam.m

📁 QPSK通过瑞利信道的MATLAB仿真
💻 M
字号:

%  2 transmit,1 receive(1bit/s/Hz)
%  16QAM    the total rate is 4bit/s/Hz orthogonal coded
clear all
clc
%SNR upto 20 dBs
EbNo=[10:3:24];

%N, M: number of transmit and receive antennas
N=2;
Num=400;% number of frame
K=40;  % numver of symbols in a frame

% initialize count
idx=1;
BIT=4;
%  BIT=2 for QPSK
%  BIT=3 for 8PSK
%  BIT=4 for 16QAM


%  the total bit is K*BIT
for en=1:length(EbNo)
    

       sigma=0.5/(10^(EbNo(en)/10));  

        % Num -> number of packets
       for packet_count=1:Num
           
           data=randint(1,K*BIT);  %%%%%%%%%%%%%%%%%%%%%%
           temp=EN_16QAM(data);
           for i=1:K/2
               x_time1(:,i)=[temp(1,(2*i-1));temp(1,2*i)];
               x_time2(:,i)=[-conj(temp(1,2*i));conj(temp(1,(2*i-1)))];
           end
           
           H=(randn(1,N)+j*randn(1,N))/sqrt(2);
           
           r_time1=H*x_time1+sqrt(sigma*N)*(randn(1,K/2)+j*randn(1,K/2));
           r_time2=H*x_time2+sqrt(sigma*N)*(randn(1,K/2)+j*randn(1,K/2));
           

           x1_est=conj(H(1,1))*r_time1+H(1,2)*conj(r_time2);
           x2_est=conj(H(1,2))*r_time1-H(1,1)*conj(r_time2);

           for i=1:K/2
               x_est(1,(2*i-1))=x1_est(1,i);
               x_est(1,2*i)=x2_est(1,i);
           end
           [x_est_bit x_est_symbol]=DE_16QAM(x_est,H);
           
           error_bit(packet_count)=sum(x_est_bit~=data);
           error_symbol(packet_count)=sum(x_est_symbol~=temp);

       end
       BER(idx)=sum(error_bit)/(BIT*Num*K);
       SER(idx)=sum(error_symbol)/(Num*K);
       idx=idx+1
   end
   
% ***************************************************
figure(1);
semilogy(EbNo,SER,'bo-');
grid on;
xlabel('SNR[dB]')
ylabel('SER')


figure(2)
semilogy(EbNo,BER,'go-');
grid on;
xlabel('SNR[dB]')
ylabel('BER')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -