Mercurial > hg > octave-lyh
annotate scripts/signal/sinc.m @ 8517:81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
author | sh@sh-laptop |
---|---|
date | Wed, 14 Jan 2009 20:44:25 -0500 |
parents | f084ba47812b |
children | eb63fbe60fab |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1994, 1996, 1997, 1999, 2000, 2004, 2005, 2007 |
2 ## John W. Eaton | |
2313 | 3 ## |
4 ## This file is part of Octave. | |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
2313 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
15 ## | |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
2303 | 19 |
3367 | 20 ## -*- texinfo -*- |
21 ## @deftypefn {Function File} {} sinc (@var{x}) | |
22 ## Return | |
23 ## @iftex | |
24 ## @tex | |
25 ## $ \sin (\pi x)/(\pi x)$. | |
26 ## @end tex | |
27 ## @end iftex | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
7125
diff
changeset
|
28 ## @ifnottex |
3367 | 29 ## sin(pi*x)/(pi*x). |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
7125
diff
changeset
|
30 ## @end ifnottex |
3367 | 31 ## @end deftypefn |
559 | 32 |
3367 | 33 ## Author: jwe ??? |
2314 | 34 |
2311 | 35 function result = sinc (x) |
559 | 36 |
7125 | 37 if (nargin != 1) |
38 print_usage (); | |
39 endif | |
40 | |
3486 | 41 result = ones (size (x)); |
559 | 42 |
3486 | 43 i = (x != 0); |
559 | 44 |
4807 | 45 if (any (i(:))) |
3486 | 46 t = pi * x(i); |
47 result(i) = sin (t) ./ t; | |
559 | 48 endif |
49 | |
50 endfunction |