image thumbnail

Comparison between unipolar and bipolar digital transmission

by

 

this M-file gives you the performance of a bipolar transmission over a unipolar transmission.

Bipolar_vs_Unipolar.m
%Comparison between unipolar and bipolar digital transmission%
clc;
close all;
clear;
%----Data generation
EBN0=0:10;
rand('seed',5); randn('seed',5);
    Nb=10000;
for k=1:11;
    Nerr_unipolaire=0;
    Nerr_bipolaire=0;
    Niter=20;
    for i=1:Niter;
d= rand (1,Nb)>0.5;

%--------mapping----------%
d_bipolaire = 2*d-1;

%---AWGN---%
    d_awgn=awgn((d*1+0.000000001*j),EBN0(k),'measured');
    d_bipolaire_awgn=awgn((d_bipolaire*1+0.000000001*j),EBN0(k),'measured');
    
%---Dcision/Dmappage---%
d_recu=d_awgn>mean(d_awgn);
d_bipolaire_recu=d_bipolaire_awgn>mean(d_bipolaire_awgn);

%---calcul du taux d'erreur---%
verr=xor(d,d_recu);
verr_bipolaire=xor(d,d_bipolaire_recu);

Nerr_unipolaire=Nerr_unipolaire+sum(verr);
Nerr_bipolaire=Nerr_bipolaire+sum(verr_bipolaire);

    end
    
BER_unipolaire(k)=Nerr_unipolaire/(Nb*Niter);
BER_bipolaire(k)=Nerr_bipolaire/(Nb*Niter);

end

figure;
semilogy(EBN0,BER_bipolaire,'b','linewidth',2);grid on;hold on;
semilogy(EBN0,BER_unipolaire,'r','linewidth',2);grid on;hold on;
legend('Bipolar form','Unipolar form');
xlabel('Eb/N0 en dB','fontsize',15);
ylabel('TEB','fontsize',15);

Contact us