The Up-sample block increases the sampling rate of the input signal by repeating values or inserting zeros.
The rate of increase of the sampling step is determined by the dialogue parameter 'Upsample factor'.
This block is capable of treating sample-based and frame-based input signals with the choice of the values of the dialogue parameter 'Type of upsample'. Choices 0 and 1 are for sampled-based signals, 1 and 2 for frame-based signals.
The following example shows the two types of output that can realize this block with an upsample factor of 8.
/* surecht Scicos temporal oversamplig and zero insert block * Type 4 simulation function ver 1.0 - scilab-3.0 * 21 décembre 2004 Author : - IRCOM GROUP - A.Layec */ /* REVISION HISTORY : * $Log$ */ #include "scicos_block.h" #include "machine.h" #include <stdio.h> /* Entrée régulière : signal à surechantilonner * Sortie régulière : signal suréchantilonné * Entrée évènementielle : néant * Sortie évènementielle : néant * * Paramètres entier : insz[0] : taille du vecteur en entrée * ipar[0] : nombre d'échantillons * ipar[1] : option * 0/1 : traitement séquentiel * 2/3 : traitement vectoriel * 0/2 : pas d'insertion de zéro * 1/3 : insertion zéro * * état discret : z[0] : valeur initiale du numéro échantillons */ /*prototype*/ void surecht(scicos_block *block,int flag) { /*déclaration des variables*/ double *y; double *u; int i,opt,nu,nech,ny; int counter; /*Récupération des adresses des ports réguliers*/ y=(double *)block->outptr[0]; u=(double *)block->inptr[0]; /*récupération du nombre d'échantillons*/ nu=block->insz[0]; nech=block->ipar[0]; ny=block->outsz[0]; opt=block->ipar[1]; /* Le flag1 test la valeur du compteur échantillon * et délivre u[] dans y[] quand le compteur * arrive à la valeur ipar[0] */ if(flag==1) {/*Vector*/ if (opt==2||opt==3) { opt=opt-2; counter=(int)block->z[0]; /*Appel routine surecht_c*/ surecht_c(&opt,&nu,&nech,&counter,&u[0],&y[0]); } /*scalar*/ else if(opt==0) { /*si z[]=ipar[0] y[]=u[]*/ if((int)block->z[0]==nech) { block->z[0]=1; /*RAZ compteur*/ for(i=0;i<block->insz[0];i++) y[i]=u[i]; } /*si z[]!=ipar[0] y[]=0*/ else { for(i=0;i<block->insz[0];i++) y[i]=0; block->z[0]++; /*incrémente compteur*/ } } else if(opt==1) { for(i=0;i<block->insz[0];i++) y[i]=u[i]; } } }