Computational routine
eng


surechfft

File content


/* Modnumlib Scicos interfacing function
 * Copyright (C) 2009-2011 Alan Layec
 *
 * This library 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.
 *
 * This library 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 this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
 
/* surech Scicos oversampling by fft
 * Type 2 simulation function ver 1.0 - scilab-2.6&2.7&3.0
 * 23 décembre 2003 - IRCOM GROUP - Author : A.Layec
 */

 /* REVISION HISTORY :
 * $Log$
 */

#include "machine.h"

/* Cette fonction réalise le suréchantillonnage par fft. Elle recopie N fois le vecteur
 * d'entrée[u1;u2] dans le vecteur de sortie [y1;y2]
 *
 * entrées réguliéres : u1[0..nu-1] : parties réelles du signal fréquentiel
 *                      u2[0..nu-1] : parties imaginaires du signal fréquenteil
 * sorties régulières : y1[0..ny-1] : parties réelles du signal fréquentiel surechantillonné
 *                      y2[0..ny-1] : parties imaginaires du signal fréquentiel surechantillonné
 * paramètres entiers : ipar[0] : N facteur de surechantillonnage
 *
 * nb : ny=N*nu
 */

/*prototype*/
void surechfft(flag,nevprt,t,xd,x,nx,z,nz,tvec,ntvec,rpar,nrpar,
               ipar,nipar,inptr,insz,nin,outptr,outsz,nout)

int *flag,*nevprt,*nx,*nz,*ntvec,*nrpar,ipar[],*nipar,insz[],*nin,outsz[],*nout;
double x[],xd[],z[],tvec[],rpar[];
double *inptr[],*outptr[],*t;
{
  /*Déclaration des variables*/
  double *y1,*y2;
  double *u1,*u2;
  int i,j,N,nu,ny;

  /*Récupération des adresses des ports réguliers*/
  y1=(double *)outptr[0];
  y2=(double *)outptr[1];
  u1=(double *)inptr[0];
  u2=(double *)inptr[1];

  /*Récupération de la taille du port d'entrée*/
  nu=insz[0];
  ny=outsz[0];

  /*Récupération du facteur de suréchantillonnage*/
  N=ipar[0];

  /*Récopie u dans y*/
  for(i=0;i<N;i++)
  {
   for(j=0;j<nu;j++)
   {
    y1[i*nu+j]=u1[j];
    y2[i*nu+j]=u2[j];
   }
  }
}