Mercurial > hg > octave-lyh
comparison scripts/signal/blackman.m @ 13068:542891ebfcdb
codesprint: 9 tests for bartlett.m
author | Andriy Shinkarchuck <adriano32.gnu@gmail.com> |
---|---|
date | Sat, 03 Sep 2011 14:09:51 -0500 |
parents | fd0a3ac60b0e |
children | 984359717d71 |
comparison
equal
deleted
inserted
replaced
13067:875577a19d70 | 13068:542891ebfcdb |
---|---|
44 k = (0 : m)' / m; | 44 k = (0 : m)' / m; |
45 c = 0.42 - 0.5 * cos (2 * pi * k) + 0.08 * cos (4 * pi * k); | 45 c = 0.42 - 0.5 * cos (2 * pi * k) + 0.08 * cos (4 * pi * k); |
46 endif | 46 endif |
47 | 47 |
48 endfunction | 48 endfunction |
49 | |
50 %!assert (blackman (1), 1); | |
51 %!assert (blackman (2), zeros(2,1), 1e-6); | |
52 %!assert (blackman (16), fliplr (blackman (16))); | |
53 %!assert (blackman (15), fliplr (blackman (15))); | |
54 %!test | |
55 %! N = 9; | |
56 %! A = blackman (N); | |
57 %! assert (A (ceil (N/2)), 1, 1e-6); | |
58 %! assert ([A(1), A(length (A))], zeros (1, 2), 1e-6); | |
59 | |
60 %!error blackman (); | |
61 %!error blackman (0.5); | |
62 %!error blackman (-1); | |
63 %!error blackman (ones(1,4)); |