2537
|
1 ## Copyright (C) 1995, 1996 Kurt Hornik |
|
2 ## |
|
3 ## This program is free software; you can redistribute it and/or modify |
|
4 ## it under the terms of the GNU General Public License as published by |
|
5 ## the Free Software Foundation; either version 2, or (at your option) |
|
6 ## any later version. |
|
7 ## |
|
8 ## This program is distributed in the hope that it will be useful, but |
|
9 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
11 ## General Public License for more details. |
|
12 ## |
|
13 ## You should have received a copy of the GNU General Public License |
|
14 ## along with this file. If not, write to the Free Software Foundation, |
|
15 ## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
16 |
3321
|
17 ## -*- texinfo -*- |
|
18 ## @deftypefn {Mapping Function} {} pow2 (@var{x}) |
|
19 ## @deftypefnx {Mapping Function} {} pow2 (@var{f}, @var{e}) |
|
20 ## With one argument, computes |
|
21 ## @iftex |
|
22 ## @tex |
|
23 ## $2^x$ |
|
24 ## @end tex |
|
25 ## @end iftex |
|
26 ## @ifinfo |
|
27 ## 2 .^ x |
|
28 ## @end ifinfo |
|
29 ## for each element of @var{x}. With two arguments, returns |
|
30 ## @iftex |
|
31 ## @tex |
|
32 ## $f \cdot 2^e$. |
|
33 ## @end tex |
|
34 ## @end iftex |
|
35 ## @ifinfo |
|
36 ## f .* (2 .^ e). |
|
37 ## @end ifinfo |
|
38 ## @end deftypefn |
|
39 |
|
40 ## See also: nextpow2 |
2537
|
41 |
|
42 ## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> |
|
43 ## Created: 17 October 1994 |
|
44 ## Adapted-By: jwe |
|
45 |
|
46 function y = pow2 (f, e) |
|
47 |
|
48 if (nargin == 1) |
|
49 y = 2 .^ f; |
|
50 elseif (nargin == 2) |
|
51 y = f .* (2 .^ e); |
|
52 else |
|
53 usage ("y = pow2 (f [, e])"); |
|
54 endif |
|
55 |
|
56 endfunction |