Programa para el testeo de las funciones.Para compilar o código example_channel_model_bsc.cpp:
g++ -static -o example_channel_model_bsc example_channel_model_bsc.cpp -lpdsramm
Para executar o programa:
./example_channel_model_bsc
Retornando por consola:
p: 0.01 BERm: 9.55e-06
p: 0.0118541 BERm: 1.57575e-05
p: 0.0140519 BERm: 2.43453e-05
p: 0.0166573 BERm: 4.49172e-05
p: 0.0197457 BERm: 7.99525e-05
p: 0.0234068 BERm: 0.000127924
p: 0.0277466 BERm: 0.000200841
p: 0.0328911 BERm: 0.000336409
p: 0.0389894 BERm: 0.000544983
p: 0.0462183 BERm: 0.000972797
p: 0.0547876 BERm: 0.00146406
p: 0.0649458 BERm: 0.00260605
p: 0.0769873 BERm: 0.00406546
p: 0.0912615 BERm: 0.00640322
p: 0.108182 BERm: 0.0106294
p: 0.12824 BERm: 0.0178581
p: 0.152017 BERm: 0.0278596
p: 0.180202 BERm: 0.0427696
p: 0.213614 BERm: 0.0746364
p: 0.253219 BERm: 0.101157
p: 0.300169 BERm: 0.1826
p: 0.355823 BERm: 0.257534
p: 0.421795 BERm: 0.33634
p: 0.5 BERm: 0.489899
example_channel_model_bsc.png
example_channel_model_bsc_theoric.png
Código example_channel_model_bsc.cpp:
#include <Pds/Ra>
#include <Pds/It>
int main(void)
{
unsigned int L=1000000;
unsigned int M=5;
unsigned int N=24;
unsigned int n;
Pds::Matrix U;
Pds::Vector Up;
Pds::Vector p(M);
Pds::Vector Rho=Pds::GeomSpace(0.01,0.5,N);
Pds::Vector BER(N);
for(n=0;n<N;n++)
{
if(n==0) L=200/1.0e-5;
else L=200/BER[n-1];
Pds::Vector Us(L);
p.Fill(Rho[n]);
Us.FillRandC(0.5);
Up=U.MeanInRows();
U.MakeEmpty();
BER.SetRaw(n,Us.Xor(Up).Mean());
Up.MakeEmpty();
std::cout<<"p: "<<Rho[n]<<"\tBERm: "<<BER[n]<<"\n";
}
Pds::Octave::XLabel="Rho";
Pds::Octave::YLabel="BER";
Pds::Octave::Legend={"Rho","BER"};
Pds::Octave::Plot::LogLogXYXY(Rho,Rho,Rho,BER,"temporal.m","example_channel_model_bsc.png");
Pds::Octave::XLabel="BERteo";
Pds::Octave::YLabel="BER";
Pds::Octave::Legend={"BERteo","BER"};
Pds::Octave::Plot::LogLogXYXY(Rho,BERteo,Rho,BER,"temporal.m","example_channel_model_bsc_theoric.png");
return 0;
}
double SymetricModel(double rho, unsigned int M)
Retorna la taza de erro de bit, , en el problema CEO binario simétrico de M fontes ,...
Pds::Matrix Bsc(const Pds::Vector &Us, const Pds::Vector &p)
Retorna el resultado de passar un vector por un banco de canales BSC de probabilidades .