/* Modnumlib Scicos interfacing function * Copyright (C) 2009 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. */ /* logistique Scicos logistique function block * Type 2 simulation function ver 1.0 - scilab-2.6&2.7 * 18 novembre 2003 - IRCOM GROUP - Author : A.Layec */ /* REVISION HISTORY : * $Log$ */ #include "machine.h" /* Cette fonction de simulation réalise la fonction non linéaire logistique : * y = 4*R*u*(1-u) * où R est un paramètre, y la sortie et u l'entrée. * * Entrées régulières : u1[0..nu-1] : vecteur du paramètre R * u2[0..nu-1] : vecteur d'entrée * Sortie régulière : y1[0..nu-1] : vecteur des sorties * Entrée évènementielle : néant (héritage) * sortie évènementielle : néant * paramètres : néant. */ /*prototype*/ void logistique(flag,nevprt,t,xd,x,nx,z,nz,tvec,ntvec,rpar,nrpar, ipar,nipar,inptr,insz,nin,outptr,outsz,nout) integer *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; double *u1; double *u2; int nu,i; /*récupération des adresses des ports réguliers*/ y1=(double *)outptr[0]; u1=(double *)inptr[0]; u2=(double *)inptr[1]; /*récupération de la taille du port d'entrée u1*/ nu = insz[0]; /*Calcule du registre de sortie*/ for(i=0;i<nu;i++) y1[i]=4*u1[i]*u2[i]*(1-u2[i]); }