This file is indexed.

/usr/share/octave/packages/signal-1.3.0/chebwin.m is in octave-signal 1.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
## Copyright (C) 2002 André Carezia <acarezia@uol.com.br>
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 3 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn  {Function File} {} chebwin (@var{L})
## @deftypefnx {Function File} {} chebwin (@var{L}, @var{at})
##
## Returns the filter coefficients of the @var{L}-point Dolph-Chebyshev window
## with @var{at} dB of attenuation in the stop-band of the corresponding
## Fourier transform.  The default attenuation value is 100 dB.
##
## For the definition of the Chebyshev window, see
##
## * Peter Lynch, "The Dolph-Chebyshev Window: A Simple Optimal Filter",
##   Monthly Weather Review, Vol. 125, pp. 655-660, April 1997.
##   (http://www.maths.tcd.ie/~plynch/Publications/Dolph.pdf)
##
## * C. Dolph, "A current distribution for broadside arrays which
##   optimizes the relationship between beam width and side-lobe level",
##   Proc. IEEE, 34, pp. 335-348.
##
## The window is described in frequency domain by the expression:
##
## @example
## @group
##          Cheb(L-1, beta * cos(pi * k/L))
##   W(k) = -------------------------------
##                 Cheb(L-1, beta)
## @end group
## @end example
##
## with
##
## @example
## @group
##   beta = cosh(1/(L-1) * acosh(10^(at/20))
## @end group
## @end example
##
## and Cheb(m,x) denoting the m-th order Chebyshev polynomial calculated
## at the point x.
##
## Note that the denominator in W(k) above is not computed, and after
## the inverse Fourier transform the window is scaled by making its
## maximum value unitary.
##
## @seealso{kaiser}
## @end deftypefn

function w = chebwin (L, at)

  if (nargin < 1 || nargin > 2)
    print_usage;
  elseif (nargin == 1)
    at = 100;
  endif

  if !(isscalar (L) && (L == round(L)) && (L > 0))
    error ("chebwin: L has to be a positive integer");
  elseif !(isscalar (at) && (at == real (at)))
    error ("chebwin: at has to be a real scalar");
  endif

  if (L == 1)
    w = 1;
  else
    ## beta calculation
    gamma = 10^(-at/20);
    beta = cosh(1/(L-1) * acosh(1/gamma));
    ## freq. scale
    k = (0:L-1);
    x = beta*cos(pi*k/L);
    ## Chebyshev window (freq. domain)
    p = cheb(L-1, x);
    ## inverse Fourier transform
    if (rem(L,2))
      w = real(fft(p));
      M = (L+1)/2;
      w = w(1:M)/w(1);
      w = [w(M:-1:2) w]';
    else
      ## half-sample delay (even order)
      p = p.*exp(j*pi/L * (0:L-1));
      w = real(fft(p));
      M = L/2+1;
      w = w/w(2);
      w = [w(M:-1:2) w(2:M)]';
    endif
  endif

  w = w ./ max (w (:));

endfunction