%Programme to plot the BER performance curves for DPSK

%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

Pdpsk=[];
Pdqpskbit=[];
xaxis1=[];
xaxis2=[];




for j = 1:100 
i=j/5;
EbNo=10^(i/10);
dpsk=0.5*exp(-EbNo);
if dpsk < 1e-6, ,break, end
Pdpsk(j)=dpsk;
xaxis1(j)=i;
end

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

figure(1)
semilogy(xaxis1,Pdpsk,'-g','linewidth',2);
hold on
semilogy(xaxis2,Pdqpskbit,'-m','linewidth',2);
hold on
title('BER curves for DPSK & DQPSK')
