0
|
1 ## Copyright (C) 1995, 1996, 1997 Kurt Hornik |
|
2 ## |
|
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. |
|
7 ## |
|
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 |
|
11 ## General Public License for more details. |
|
12 ## |
|
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 |
|
17 ## usage: kaiser (n, beta) |
|
18 ## |
|
19 ## Returns the filter coefficients of the n-point Kaiser window with |
|
20 ## parameter beta. |
|
21 ## |
|
22 ## For the definition of the Kaiser window, see A. V. Oppenheim & |
|
23 ## R. W. Schafer, "Discrete-Time Signal Processing". |
|
24 ## |
|
25 ## The continuous version of width n centered about x=0 is: |
|
26 ## |
|
27 ## besseli(0, beta * sqrt(1-(2*x/n).^2)) |
|
28 ## k(x) = -------------------------------------, n/2 <= x <= n/2 |
|
29 ## besseli(0, beta) |
|
30 ## |
|
31 ## See also: kaiserord |
|
32 |
|
33 ## Author: KH <Kurt.Hornik@ci.tuwien.ac.at> |
|
34 ## Description: Coefficients of the Kaiser window |
|
35 |
|
36 ## 2000-02 Paul Kienzle (pkienzle@kienzle.powernet.co.uk) |
|
37 ## use besseli rather than jybess |
|
38 ## note, although Oppenheim & Schafer, 2nd edition has a formula |
|
39 ## which looks completely different than the one herein, it gives |
|
40 ## identical results |
|
41 |
|
42 function w = kaiser (n, beta) |
|
43 |
|
44 if (nargin != 2) |
|
45 usage ("kaiser (n, beta)"); |
|
46 endif |
|
47 |
|
48 if !(is_scalar (n) && (n == round (n)) && (n > 0)) |
|
49 error ("kaiser: n has to be a positive integer"); |
|
50 endif |
|
51 if !(is_scalar (beta) && (beta == real (beta))) |
|
52 error ("kaiser: beta has to be a real scalar"); |
|
53 endif |
|
54 |
|
55 if (n == 1) |
|
56 w = 1; |
|
57 else |
|
58 m = n - 1; |
|
59 k = (0 : m)'; |
|
60 k = 2 * beta / m * sqrt (k .* (m - k)); |
|
61 w = besseli (0, k) / besseli (0, beta); |
|
62 endif |
|
63 |
|
64 endfunction |
|
65 |
|
66 %!demo |
|
67 %! % use demo("kaiserord"); |