]> Creatis software - CreaPhase.git/blob - octave_packages/secs1d-0.0.8/Utilities/Ubernoulli.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / secs1d-0.0.8 / Utilities / Ubernoulli.m
1
2 function b=Ubernoulli(x,sg)
3
4 %
5 %   b=Ubernoulli(x,sg)
6 %   
7 %   Bernoulli function
8 %   b = B(x)=x/(exp(x)-1) if sg==1
9 %   b = B(-x)=x+B(x)      if sg==0
10 %   also works if x is a vector
11   
12  ## This file is part of 
13   ##
14   ## SECS1D - A 1-D Drift--Diffusion Semiconductor Device Simulator
15   ## -------------------------------------------------------------------
16   ## Copyright (C) 2004-2007  Carlo de Falco
17   ##
18   ##
19   ##
20   ##  SECS1D is free software; you can redistribute it and/or modify
21   ##  it under the terms of the GNU General Public License as published by
22   ##  the Free Software Foundation; either version 2 of the License, or
23   ##  (at your option) any later version.
24   ##
25   ##  SECS1D is distributed in the hope that it will be useful,
26   ##  but WITHOUT ANY WARRANTY; without even the implied warranty of
27   ##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28   ##  GNU General Public License for more details.
29   ##
30   ##  You should have received a copy of the GNU General Public License
31   ##  along with SECS1D; If not, see <http://www.gnu.org/licenses/>.
32   
33   for count=1:length(x)
34     [bp,bn] = Ubern(x(count));
35     bernp(count,1)=bp;
36     bernn(count,1)=bn;
37   end
38   
39   if (sg ==1)
40     b=bernp;
41   elseif (sg ==0)
42     b=bernn;
43   end
44   
45   
46   % Last Revision:
47   % $Author: adb014 $
48   % $Date: 2008-02-04 16:26:27 +0100 (man, 04 feb 2008) $
49