3191
|
1 ## Copyright (C) 1995, 1996, 1997 Andreas Weingessel |
3426
|
2 ## |
3191
|
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. |
3426
|
7 ## |
3191
|
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 |
3426
|
11 ## General Public License for more details. |
|
12 ## |
3191
|
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 |
3449
|
17 ## -*- texinfo -*- |
|
18 ## @deftypefn {Function File} {} sinewave (@var{m}, @var{n}, @var{d}) |
|
19 ## Return an @var{m}-element vector with @var{i}-th element given by |
|
20 ## @code{sin (2 * pi * (@var{i}+@var{d}-1) / @var{n})}. |
3191
|
21 ## |
3449
|
22 ## The default value for @var{d} is 0. |
|
23 ## @end deftypefn |
3191
|
24 |
3457
|
25 ## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> |
|
26 ## Description: Compute a sine wave |
3191
|
27 |
|
28 function x = sinewave (m, n, d) |
3426
|
29 |
3191
|
30 if (nargin == 2) |
|
31 d = 0; |
|
32 elseif (nargin != 3) |
3449
|
33 usage ("sinewave (m, n, d)"); |
3191
|
34 endif |
|
35 |
3457
|
36 x = sin (((1 : m) + d - 1) * 2 * pi / n); |
3191
|
37 |
|
38 endfunction |