Mercurial > hg > octave-lyh
comparison scripts/signal/rectangle_sw.m @ 3457:e031284eea27
[project @ 2000-01-19 08:49:56 by jwe]
author | jwe |
---|---|
date | Wed, 19 Jan 2000 08:50:14 +0000 |
parents | 858695b3ed62 |
children | 38c61cbf086c |
comparison
equal
deleted
inserted
replaced
3456:434790acb067 | 3457:e031284eea27 |
---|---|
18 ## @deftypefn {Function File} {} rectangle_sw (@var{n}, @var{b}) | 18 ## @deftypefn {Function File} {} rectangle_sw (@var{n}, @var{b}) |
19 ## Rectangular spectral window. Subfunction used for spectral density | 19 ## Rectangular spectral window. Subfunction used for spectral density |
20 ## estimation. | 20 ## estimation. |
21 ## @end deftypefn | 21 ## @end deftypefn |
22 | 22 |
23 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> | 23 ## Author: FL <Friedrich.Leisch@ci.tuwien.ac.at> |
24 ## Description: Rectangular spectral window | 24 ## Description: Rectangular spectral window |
25 | 25 |
26 function retval = rectangle_sw (n, b) | 26 function retval = rectangle_sw (n, b) |
27 | 27 |
28 retval = zeros (n, 1); | 28 retval = zeros (n, 1); |
29 retval(1) = 2 / b + 1; | 29 retval(1) = 2 / b + 1; |
30 | 30 |
31 l = (2:n)' - 1; | 31 l = (2:n)' - 1; |
32 l = 2 * pi * l / n; | 32 l = 2 * pi * l / n; |
33 | 33 |
34 retval(2:n) = sin( (2/b + 1) * l / 2 ) ./ sin (l / 2); | 34 retval(2:n) = sin ((2/b + 1) * l / 2) ./ sin (l / 2); |
35 | 35 |
36 endfunction | 36 endfunction |
37 | 37 |
38 | 38 |
39 | 39 |