ber.m
Upload User: cjx922
Upload Date: 2017-12-13
Package Size: 205k
Code Size: 1k
Category:

Communication

Development Platform:

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.