Triangular window

### 20.5.13 Triangular window

The triangle_window command applies the triangle window function to a sequence or its segment.

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

  wk=1− | ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ |
  k− |
  N−1
  2
  N+d
  2
  | ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ | , k=0,1,…,N−1.

The case d=−1 is called the Bartlett window function.

#### Example

listplot(triangle_window([1$1000],1))