summaryrefslogtreecommitdiff
path: root/macros/bohmanwin.sci
blob: 8f391c89ea2385439e99d28a752621f00f0e36e9 (plain)
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
function w = bohmanwin (m)

 funcprot(0);
    rhs= argn(2);

  if (rhs ~= 1)
     error("Wrong Number of input arguments");
  end

  if (~ (isscalar (m) & (m == fix (m)) & (m > 0)))
    error ("bohmanwin: M must be a positive integer");
  end

  if (m == 1)
    w = 1;
  else
    N = m - 1;
    n = -N/2:N/2;

    w = (1-2.*abs(n)./N).*cos(2*%pi.*abs(n)./N) + (1/%pi).*sin(2*%pi.*abs(n)./N);
    w(1) = 0;
    w(length(w))=0;
    w = w';
  end

endfunction