/* cw_c subroutine * Noisy Constant Wave computation * 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" /* cw_c : routine de calcul d'une onde à fréquence constante (1 ou 2 composantes) * * Entrées : * n : longueur du vecteur * ampl : amplitude de l'onde * opt : option de la routine (1:cos, 2:sin, 3:cos et sin) * theta_i : pas d'incrémentation de l'angle * * Sorties : * y1 : adresse de départ du vecteur de sortie composante réelle * y2 : adresse de départ du vecteur de sortie composante imaginaire * * Entrées/Sorties : * theta : angle instantanée * * Dépendances : * math.h * */ void cw_c(int *n,double *ampl,int *opt,double *theta_i,double *y1,double *y2,double *theta) { /*déclaration*/ int i; for (i=0;i<(*n);i++) { switch (*opt) { case 1 : { y1[i]=(*ampl)*cos((*theta)); break; } case 2 : { y2[i]=(*ampl)*sin((*theta)); break; } case 3 : { y1[i]=(*ampl)*cos((*theta)); y2[i]=(*ampl)*sin((*theta)); break; } } *theta=(*theta)+(*theta_i); } return; }