Home > phiwave > uvi_wave > fact.m

fact

PURPOSE ^

FACT Factorial.

SYNOPSIS ^

function y=fact(x)

DESCRIPTION ^

 FACT   Factorial.
        FACT(X) is the factorial of the elements in X vector.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function y=fact(x)
0002 
0003 % FACT   Factorial.
0004 %        FACT(X) is the factorial of the elements in X vector.
0005 
0006 %--------------------------------------------------------
0007 % Copyright (C) 1994, 1995, 1996, by Universidad de Vigo
0008 %
0009 %
0010 % Uvi_Wave is free software; you can redistribute it and/or modify it
0011 % under the terms of the GNU General Public License as published by the
0012 % Free Software Foundation; either version 2, or (at your option) any
0013 % later version.
0014 %
0015 % Uvi_Wave is distributed in the hope that it will be useful, but WITHOUT
0016 % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0017 % FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0018 % for more details.
0019 %
0020 % You should have received a copy of the GNU General Public License
0021 % along with Uvi_Wave; see the file COPYING.  If not, write to the Free
0022 % Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
0023 %
0024 %       Author: Nuria Gonzalez Prelcic
0025 %       e-mail: Uvi_Wave@tsc.uvigo.es
0026 %--------------------------------------------------------
0027 
0028 for j=1:length(x)
0029     if x(j)==0,
0030        y(j)=1;
0031     else
0032        y(j)=x(j)*fact(x(j)-1);
0033     end
0034 end
0035 
0036 
0037 
0038

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003