Mercurial > hg > octave-lyh
annotate scripts/signal/bartlett.m @ 12594:a3a7da1489b2 stable
Modify func.txi discussion of output arguments to include discussion of isargout.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 11 Apr 2011 19:03:32 -0700 |
parents | fd0a3ac60b0e |
children | b3a8b75dfec3 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 1995-2011 Andreas Weingessel |
3426 | 2 ## |
3922 | 3 ## This file is part of Octave. |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
3426 | 9 ## |
3922 | 10 ## Octave is distributed in the hope that it will be useful, but |
3191 | 11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
3426 | 13 ## General Public License for more details. |
14 ## | |
3191 | 15 ## You should have received a copy of the GNU General Public License |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
3191 | 18 |
3449 | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {} bartlett (@var{m}) | |
21 ## Return the filter coefficients of a Bartlett (triangular) window of | |
22 ## length @var{m}. | |
3191 | 23 ## |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
24 ## For a definition of the Bartlett window, see e.g., A. V. Oppenheim & |
8484
895d49a7e36a
[docs] "Discrete-Time Signal Processing" => @cite{Discrete-Time Signal Processing}
Brian Gough <bjg@gnu.org>
parents:
7017
diff
changeset
|
25 ## R. W. Schafer, @cite{Discrete-Time Signal Processing}. |
3449 | 26 ## @end deftypefn |
3191 | 27 |
3457 | 28 ## Author: AW <Andreas.Weingessel@ci.tuwien.ac.at> |
29 ## Description: Coefficients of the Bartlett (triangular) window | |
3191 | 30 |
31 function c = bartlett (m) | |
3426 | 32 |
3191 | 33 if (nargin != 1) |
6046 | 34 print_usage (); |
3191 | 35 endif |
3426 | 36 |
4030 | 37 if (! (isscalar (m) && (m == round (m)) && (m > 0))) |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
9051
diff
changeset
|
38 error ("bartlett: M has to be an integer > 0"); |
3191 | 39 endif |
3426 | 40 |
3191 | 41 if (m == 1) |
42 c = 1; | |
43 else | |
44 m = m - 1; | |
45 n = fix (m / 2); | |
4172 | 46 c = [2*(0:n)/m, 2-2*(n+1:m)/m]'; |
3191 | 47 endif |
48 | |
49 endfunction |