ber.m
上传用户:cjx922
上传日期:2017-12-13
资源大小:205k
文件大小:1k
源码类别:

通讯编程

开发平台:

Matlab

  1. function [y]=ber(snr,modulation_type,fading_type);
  2. %根据调制方式和衰落方式计算单链路ber
  3. switch fading_type
  4.     case 'Rayleigh'
  5.         switch modulation_type
  6.             case 'BPSK'
  7.                 y=(1-sqrt(snr./(1/2+snr)))/2;
  8.             case 'QPSK'
  9.                 y=(1-sqrt(snr./(1+snr)))/2;
  10.             otherwise
  11.                 error(['Modulation-type unkonwn:',modulation_type]);
  12.         end
  13.         
  14.     case 'no'
  15.         switch modulation_type
  16.             case 'BPSK'
  17.                 y=q(sqrt(2*snr));
  18.             case 'QPSK'
  19.                 y=q(sqrt(snr));
  20.             otherwise
  21.                 error(['Modulation-type unkonwn:',modulation_type]);
  22.         end
  23.     otherwise
  24.         error(['Fading-type unknown:',fading_type]);
  25. end
  26.                 
  27.