/* intsym_c subroutine * Symbol discrete integrator * 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 "modnum_lib.h" /* intsym_c routine de calcul d'intégration symbole Entrées : n : taille des vecteurs (scalaire) nech : nombre d'échantillons par symbole (scalaire) count : valeur initiale du compteur (scalaire) step : pas d'intégration (scalaire) u : vecteur à intégrer (vecteur) Sorties : y : vecteur intégré (scalaire) Entrée/Sortie : z : échantillon mémoire (scalaire) */ void intsym_c(int *n,int *nech,int *init_c,double *step,double *u,double *y,double *z) { /*Déclaration des variables compteurs*/ int i; int count; /*récupère valeur initiale*/ count=*init_c; /*pour tous les échantillons du vecteur d'entrée*/ for(i=0;i<(*n);i++) { if(i==count) { count += *nech; y[i]=0; } else { if(i==0) y[i]=2/(*step)*(u[i]+u[i-1])+(*z); else if(i==(*n)-1) { y[i]=2/(*step)*(u[i]+u[i-1])+y[i-1]; (*z)=y[i]; } else y[i]=2/(*step)*(u[i]+u[i-1])+y[i-1]; } } return; }