### 21.5.14 Tukey window

The tukey_window command applies the Tukey window function to a sequence or its segment.

- tukey_window takes one mandatory argument and up to three optional arguments:
  - v, a real vector with length n.
  - Optionally, one of:
    - α, a real number in [0,1] (by default, α=0.5).
    - m,N ⟨,α⟩, a sequence of two integers and optionally a real number α∈[0,1] (by default, m=0 and N=n).
- tukey_window returns the elementwise product of [vm,vm+1,…,vm+N−1] and the vector w of length N defined by

  wk= |
  ⎧ ⎪ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎪ ⎩ |
  1
  2
  |  | ⎛ ⎜ ⎜ ⎝ | 1+cos | ⎛ ⎜ ⎜ ⎝ | π | ⎛ ⎜ ⎜ ⎝ |
  k
  β
  | −1 | ⎞ ⎟ ⎟ ⎠ | ⎞ ⎟ ⎟ ⎠ | ⎞ ⎟ ⎟ ⎠ | ,
  | k<β,
  1, |
  β≤ k≤(N−1) | ⎛ ⎜ ⎜ ⎝ | 1− |
  α
  2
  | ⎞ ⎟ ⎟ ⎠ | ,
  1
  2
  |  | ⎛ ⎜ ⎜ ⎝ | 1+cos | ⎛ ⎜ ⎜ ⎝ | π | ⎛ ⎜ ⎜ ⎝ |
  k
  β
  | − |
  2
  α
  | +1 | ⎞ ⎟ ⎟ ⎠ | ⎞ ⎟ ⎟ ⎠ | ⎞ ⎟ ⎟ ⎠ | ,
  | otherwise,

  where β=α (N−1)/2, for k=0,1,…,N−1.

#### Example

listplot(tukey_window([1$1000],0.4))