Low level routine
eng - fr


noiseiq_c - white gaussian noise generator for quadrature signals computational routine

Library

Parameters

File content


/* noiseiq_c subroutine
 * Gaussian Noise generator
 * with Box Muller Law method
 * for complex values
 * IRCOM GROUP - Author : A.Layec
 */
 
/* REVISION HISTORY :
 * $Log$
 */

#include "mod_num_lib.h"

/* noiseiq_c routine de calcul d'échantillons bruités par la méthode "Box Muller Law"
 *
 * Entrées :
 * n    : taille des vecteurs
 * sig  : variance (scalaire)
 * mean : moyenne (scalaire)
 * Sorties :
 * i_c : vecteur des composantes I
 * i_q : vecteur des composantes Q
 * 
 * dépendances
 * math.h
 */

void noiseiq_c(int *n,double *sig,double *mean,double *i_c,double *i_q)
{
 /*déclaration des variables*/
 int i;
 double rand1, rand2;
 double rand_m;
 double ampl, phase;
  
 /*récupération de la valeur de RAND_MAX*/
 rand_m=RAND_MAX;
 
 for(i=0;i<(*n);i++)
     {
       /*calcul rand1*/
       rand1=rand()/rand_m;
       /*test rand1*/
       while((rand1<=0)||(rand1>=1)) rand1=rand()/rand_m;
       
       /*calcul rand2*/
       rand2=rand()/rand_m;
       /*test rand2*/
       while((rand2<=0)||(rand2>=1)) rand2=rand()/rand_m;

       /*Calcul amplitude et phase*/
       ampl=(*sig)*sqrt(-log(rand1));
       phase=2*M_PI*rand2;

       /*Calcul i_c et i_q*/
       i_c[i]=(*mean)+ampl*cos(phase);
       i_q[i]=(*mean)+ampl*sin(phase);
      }
 return;
}

Authors

IRCOM Group Alan Layec