%%%%%   Hadamard正交编码+BPSK误码性能分析  %%%%%%%%%%%%%%%%
NVec = [8 16 32 64 128  ]; % Values of N to consider(编码效率)
EbNoVec =3:9;SNRVec=zeros(1,length(NVec));
nSamp = 1; 
M = 2;                      % Size of signal constellation
k = log2(M);                % Number of bits per symbol
cont=0;
hMod = modem.pskmod(M);         % Create a M-PSK modulator
hMod.InputType = 'Bit';         % Accept bits as inputs
hMod.SymbolOrder = 'Gray';      % Accept bits as inputs
hDemod = modem.pskdemod(hMod);

number_of_errors = zeros(length(NVec),length(EbNoVec));
bit_error_rate1  = zeros(length(NVec),length(EbNoVec));
 
for idxN = 1:length(NVec)
 N=NVec(idxN);%  符号比特数;
 H=hadamard(N);   % 生成Hadamard矩阵  
 h = log2(N);  % 消息比特数;
 coderate=h/N;%符号率
  for i=1:N                   % 符号替换
      for j=1:N 
        if (H(i,j)==-1),
            H(i,j)=0;
        end;
    end;
end

n = h*floor(100000   /h); % Number of bits to process
  for idxEbNo = 1:length(EbNoVec)                       
  figure(1);

%% Simulation loops

x = randi([0 1],n,1); % Random binary data stream
    xsym = bi2de(reshape(x,h,length(x)/h).','left-msb');% 产生(0 to h-1)
    x_enc=xsym+1 ;% 从1到 h范围的信息符号字
   
   codeword=zeros(length(xsym),N); 
   decodeword=zeros(length(xsym),N); 
   zsym=zeros(length(xsym),1);
   
  for l=1:length(x_enc)   
   codeword(l,:)=H(x_enc(l),:) ; %  对每个信息符号相当的符号字
   f=codeword(l,:)';
   y = modulate(hMod,f) ; 
   yTx = y;
   
   %% Channel
   % Send signal over an AWGN channel.
   EbNo = EbNoVec(idxEbNo); % In dB
   SNR = EbNo +10*log10(k*coderate) - 10*log10(nSamp);
   SNRVec(idxEbNo)=SNR;
   yNoisy = awgn(yTx,SNR,'measured');
   
   %% Received Signal
   yRx = yNoisy;   
   
   %%  Demodulating 
   rcvword_C = demodulate(hDemod,yRx) ;
   %% Hadamard_decoding
   rcvword =rcvword_C';
   tt=xor(f,rcvword_C);%tt'
   minnum=1 ;
   min=N ;
for i=1:N
    d=0;
    for j=1:N %计算接受符号和Hadamard行列各行之间的汉明距离
        if (rcvword(1,j)~=H(i,j)),
            d=d+1;
        end;
    end;
    if (d<min),%探索最小汉明距离
        min=d; 
        minnum=i; 
    end;
end;
  zsym(l)=minnum-1;
  decodeword(l,:)=H(minnum,:);
  if((f~=rcvword_C  )), %&&  (decodeword(l,:)==codeword(l,:) )
      cont=cont+1;
  end;
 end  ;    
  z = de2bi(zsym',h,'left-msb'); % Convert integers to bits.
  % Convert z from a matrix to a vector.
  z = reshape(z.',numel(z),1);  
  
 
  %% BER Computation
      % Compare x and z to obtain the number of errors and
      % the bit error rate.
      [number_of_errors(idxN,idxEbNo),bit_error_rate1(idxN,idxEbNo)] = ...
          biterr(x,z) 
    
 
  end % End of loop over EbNo values

markerchoice1 =   '.xo*sd';
 markerchoice2 =   'bgcmyk';
 figure(1);
   plotsym = [markerchoice1(idxN) markerchoice2(idxN) '-']; % Plotting style for this curve
   semilogy(EbNoVec,bit_error_rate1(idxN,:),plotsym); % Plot one curve.
   drawnow; % Update the plot instead of waiting until the end.
   hold on; % Make sure next iteration does not remove this curve.
  figure(2);
  plotsym = [markerchoice1(idxN) markerchoice2(idxN) '-']; % Plotting style for this curve
   semilogy(SNRVec,bit_error_rate1(idxN,:),plotsym); % Plot one curve.
   drawnow; % Update the plot instead of waiting until the end.
   hold on; % Make sure next iteration does not remove this curve.
end  % End of loop over N values

%% Complete the plot.

%%%%%%%%%%%%%%%%%%%%%%% Noncoded-BPSK %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
M = 2;                      % Size of signal constellation
k = log2(M);                % Number of bits per symbol
n=100000                    % Number of bits to process
nSamp = 1;

hMod = modem.pskmod(M);         % Create a MPSK modulator
hMod.InputType = 'Bit';         % Accept bits as inputs
hMod.SymbolOrder = 'Gray';      % Accept bits as inputs
hDemod = modem.pskdemod(hMod);

%% Preallocate space for results.

bit_error_rate2   = zeros(1,length(EbNoVec));

for idxEbNo = 1:length(EbNoVec)                
           
    x = randi([0 1],n,1); % Random binary data stream
    y = modulate(hMod,x) ; 
   yTx = y;
   
   %% Channel
   % Send signal over an AWGN channel.
   EbNo = EbNoVec(idxEbNo); % In dB
   SNR = EbNo + 10*log10(k) - 10*log10(nSamp);
   SNRVec(idxEbNo)=SNR;
   yNoisy = awgn(yTx,SNR,'measured');
   
   %% Received Signal
   yRx = yNoisy;   
   
   %%  Demodulating 
  z  = demodulate(hDemod,yRx) ;
   
  %% BER Computation
      % Compare x and z to obtain the number of errors and
      % the bit error rate.
      [number_of_errors(1,idxEbNo),bit_error_rate2(1,idxEbNo)] = ...
          biterr(x,z)  
      
  end % End of loop over EbNo values
  
figure(1)
   semilogy(EbNoVec,bit_error_rate2(1,:),'-rd'); % Plot one curve.
   drawnow; % Update the plot instead of waiting until the end.
   hold on; % Make sure next iteration does not rermove this curve.
figure(2)
   semilogy(SNRVec,bit_error_rate2(1,:),'-rd'); % Plot one curve.
   drawnow; % Update the plot instead of waiting until the end.
   hold on; % Make sure next iteration does not rermove this curve.

figure(1)
title('Performance of Hadamard-BPSK for Varying N');
xlabel('EbNo (dB)'); ylabel('BER');
 legend('N =8','N =16','N =32','N=64','N=128','Noncoded BPSK',...
   'Location','SouthWest')  
figure(2)
title('Performance of Hadamard-BPSK for Varying N');
xlabel('SNR (dB)'); ylabel('BER');
legend('N =8','N =16','N =32','N=64','N=128','Noncoded BPSK',...
   'Location','SouthWest')

Hadamard正交编码+BPSK误码性能分析相关推荐

  1. 直扩 单音干扰抑制 matlab,单频干扰在直扩系统中的误码性能分析

    收稿日期 :2004 - 05 - 08 收修改稿日期 :2004 - 07 - 28 单频干扰在直扩系统中的误码性能分析 许 靖 谷春燕 易克初 (西安电子科技大学综合业务网国家重点实验室 ,西安 ...

  2. Tesla T4视频编码性能分析

    Tesla T4视频编码性能分析 从开普勒开始的所有 NVIDIA GPUs 都支持完全加速的硬件视频编码: GPUs 支持完全加速的硬件视频解码.最近发布的图灵硬件提供了张量核心和更好的机器学习性能 ...

  3. 基于matlab的qpsk与bpsk信号性能比较仿真,基于matlab的QPSK与BPSK信号性能比较仿真.doc...

    基于matlab的QPSK与BPSK信号性能比较仿真.doc 2装订线目 录第一章概述2第二章QPSK通信系统原理与仿真22.1 QPSK系统框图介绍22.2QPSK信号的调制原理32.2.1QPSK ...

  4. matlab 性能分析方法,DPCM,PSK系统的MATLAB实现及性能分析

    DPCM/PSK系统的MATLAB实现及 性能分析 学生姓名:指导老师: 摘要:本课程设计主要是为了进一步理解DPCM编码解码和PSK调制解调原理,并能通过MATLAB系统软件来实现对DPCM编码解码 ...

  5. m基于MATLAB的上行链路MIMO关键技术的研究与性能分析

    目录 1.算法概述 2.仿真效果预览 3.MATLAB部分代码预览 4.完整MATLAB程序 1.算法概述 多输入多输出(MIMO)天线技术的巨大潜力为新一代无线通信技术的研究提供了广阔的舞台.近年来 ...

  6. dpsk调制解调 matlab,2DPSK调制与解调系统的MATLAB实现及性能分析.doc

    2DPSK调制与解调系统的MATLAB实现及性能分析 2DPSK调制与解调系统的MATLAB实现及性能分析 摘 要:MATLAB集成环境下的Simulink仿真平台,设计一个2DPSK调制与解调系统. ...

  7. matlab 课程设计循环码性能分析,matlab课程设计--循环码的性能分析.docx

    matlab课程设计--循环码的性能分析.docx 课程设计任务书学生姓名 专业班级 指导教师 工作单位 题目 循环码的性能分析 初始条件 MATLAB,速率为100Bd的矩形输入信号,AWGN信道要 ...

  8. 数字基带部分响应matlab,第Ⅰ类部分响应系统的抗噪声性能分析与仿真

    第Ⅰ类部分响应系统的抗噪声性能分析与仿真 陈海英 (漳州师范学院物理与电子信息工程系,福建 漳州363000) 摘要:分析了第Ⅰ类部分响应系统的抗噪声性能,并利用MATLAB软件仿真计算不同信噪比下的 ...

  9. 数字通信系统简易信道编码仿真与性能分析

    移动通信普遍存在干扰与衰落的问题,这些问题会导致信号收发双方的信息差错,因此有必要增强数据在信道中传输时抵御各种干扰的能力,提高系统的可靠性,对要在信道中传送的数字信号进行的纠错检错编码的过程就是信道 ...

最新文章

  1. [转] 大连理工大学部分有效FTP列表1.0
  2. 决策树和随机森林(下)
  3. Evidence gathering tools
  4. vim上下左右键输出A B
  5. Dictionary 序列化与反序列化
  6. Spring中采用公共变量并发问题解决
  7. Python继承范例
  8. 随手记_英语_学术写作
  9. 【真人手势动画制作软件】万彩手影大师教程 | 预览、保存及发布视频
  10. ICP算法、Robust_ICP算法
  11. 万万没想到,低功耗也会烧毁元器件?
  12. This Apple ID has not yet been used in the ITunes Store/此Apple ID尚未在iTunes Store使用过
  13. android 各种服务介绍,Android 网络服务介绍
  14. 人工智能医疗:小荷健康竞品分析报告
  15. adb 强制删除系统应用
  16. [无私分享]最新网盘资源搜索站点
  17. 用Python学《微积分B》(多元函数的极限)
  18. Android视频直播、点播播放器哪家强?
  19. spring 实现异步非阻塞长轮询
  20. 锁存器原理/门电路/寄存器

热门文章

  1. 运用smali自己主动注入技术分析android应用程序行为
  2. 【项目管理】Java使用pdfbox调用打印机打印PDF文件
  3. Science:病原菌激活植物内生菌群的抑病功能
  4. 小程序流量全面爆发,谁会湾道超车
  5. niushop打包云闪付小程序,调起云闪付授权登录
  6. c语言记忆化搜索,HNUSTC语言基础简单数据结构acm入门第一讲搜索.ppt
  7. 2020RT-Thread开发者大会RDC来了~
  8. 在CentOS6上编译安装实现LAMP(php-modules)+phpMyAdmin安装过程全记录
  9. 金仓数据库KingbaseES数据库开发指南(2. 开发基础)
  10. 名帖392 启功 草书《临董其昌琵琶行》