ber_psk.m

来自「Bit Erroe Rate for PSK in MatLab」· M 代码 · 共 73 行

M
73
字号
%Programme to plot the BER performance curves for M-ary PSK

%Written by Andrew Bateman.

%set up figure numbers and location on the screen

figure(1)
close
h=figure('position',[90 341 394 369],'color',[1,1,0]);
h=axes('position',[100,331,404,379],'color',[0,1,0]);
clf

%initialise vectors

Pcohpsk=[];
Pqpsksym=[];
P8psksym=[];
P16psksym=[];
xaxis1=[];
xaxis2=[];
xaxis3=[];
xaxis4=[];

%Calculate BER curves


for j = 1:100 
i=j/5;
EbNo=10^(i/10);
cohpsk= 0.5*(erfc(sqrt(EbNo)));
if cohpsk < 1e-6, ,break, end
Pcohpsk(j)=cohpsk;
xaxis1(j)=i;
end

for j = 1:100 
i=j/5;
EbNo=10^(i/10);
qpsksym= (erfc(sqrt(EbNo)))*(1-0.25*(erfc(sqrt(EbNo))));
if qpsksym < 1e-6, ,break, end
Pqpsksym(j)=qpsksym;
xaxis2(j)=i;
end

for j = 1:100 
i=j/5;
EbNo=10^(i/10);
psksym=erfc((sqrt(3*EbNo))*sin(pi/8));
if psksym < 1e-6, ,break, end
P8psksym(j)=psksym;
xaxis3(j)=i;
end

for j = 1:100 
i=j/5;
EbNo=10^(i/10);
psksym=erfc((sqrt(4*EbNo))*sin(pi/16));
if psksym < 1e-6, ,break, end
P16psksym(j)=psksym;
xaxis4(j)=i;
end

figure(1)
semilogy(xaxis1,Pcohpsk,'-k','linewidth',2);
hold on
semilogy(xaxis2,Pqpsksym,'-g','linewidth',2);
hold on
semilogy(xaxis3,P8psksym,'-b','linewidth',2);
hold on
semilogy(xaxis4,P16psksym,'-m','linewidth',2);
hold on
title('BER curves for M-ary PSK')

⌨️ 快捷键说明

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