Low level routine
fr - eng


demodpsk_c - M-ary Phase Shift Keying demodulator computational routine

Parameters

File content


/* demodpsk_c subroutine
 * Phase Shift Keying demodulator
 * IRCOM GROUP - Author : A.Layec
 *
 * Copyright (C) 2007 Alan Layec
 *
 * This file is part of modnumlib.
 *
 * modnumlib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * modnumlib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with modnumlib; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

/* REVISION HISTORY :
 * $Log$
 */

#include <math.h>

#include "modnum_lib.h"

/* demodpsk_c routine de calcul de démodulation PSK
 *
 * Entrées :
 * n      : taille des vecteur originaux
 * m      : nombre d'états (scalaire)
 * i_c    : vecteur de la composante I
 * q_c    : vecteur de la composante Q
 * Sorties :
 * y      : vecteur du numéro symbole
 *
 * dépendance :
 * math.h
 */

void demodpsk_c(int *n,int *m,double *i_c,double *i_q,double*y)
{
 /*Déclaration des variables*/
 int i;
 double phi;

 for(i=0;i<(*n);i++)
 {
  /*Calcul de la phase*/
  phi=atan2(-i_q[i],i_c[i]);
  if(phi<0) phi = phi + 2*M_PI;
  /*Calcul du numéro symbole*/
  y[i]=(int)(phi*(*m)/(2*M_PI));
 }
 return;
}

Authors

IRCOM Group Alan Layec