1 ## Copyright (C) 2002 André Carezia <acarezia@uol.com.br>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
16 ## Usage: chebwin (L, at)
18 ## Returns the filter coefficients of the L-point Dolph-Chebyshev window
19 ## with at dB of attenuation in the stop-band of the corresponding
22 ## For the definition of the Chebyshev window, see
24 ## * Peter Lynch, "The Dolph-Chebyshev Window: A Simple Optimal Filter",
25 ## Monthly Weather Review, Vol. 125, pp. 655-660, April 1997.
26 ## (http://www.maths.tcd.ie/~plynch/Publications/Dolph.pdf)
28 ## * C. Dolph, "A current distribution for broadside arrays which
29 ## optimizes the relationship between beam width and side-lobe level",
30 ## Proc. IEEE, 34, pp. 335-348.
32 ## The window is described in frequency domain by the expression:
34 ## Cheb(L-1, beta * cos(pi * k/L))
35 ## W(k) = -------------------------------
40 ## beta = cosh(1/(L-1) * acosh(10^(at/20))
42 ## and Cheb(m,x) denoting the m-th order Chebyshev polynomial calculated
45 ## Note that the denominator in W(k) above is not computed, and after
46 ## the inverse Fourier transform the window is scaled by making its
47 ## maximum value unitary.
51 function w = chebwin (L, at)
55 elseif !(isscalar (L) && (L == round(L)) && (L > 0))
56 error ("chebwin: L has to be a positive integer");
57 elseif !(isscalar (at) && (at == real (at)))
58 error ("chebwin: at has to be a real scalar");
66 beta = cosh(1/(L-1) * acosh(1/gamma));
70 # Chebyshev window (freq. domain)
72 # inverse Fourier transform
79 # half-sample delay (even order)
80 p = p.*exp(j*pi/L * (0:L-1));
84 w = [w(M:-1:2) w(2:M)]';