Engee documentation

triang

Triangular window.

Library

EngeeDSP

Syntax

Function call

  • w = triang(L) — returns L-point triangular window.

  • w = triang(L, typeName) — also uses the argument typeName, which sets the window accuracy value w: single or double.

Arguments

Input arguments

# L — window length

+ scalar

Details

The window length specified as a positive integer.

If you specify L as a non-integer number, the function will round it to the nearest integer value.
Типы данных

Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

# typeName — type of output data

+ Float64 (by default) | Float32

Details

The type of output data specified as:

  • Float64 — use this value to return the output of w with double precision.

  • Float32 — use this value to return the output of w with single precision.

Типы данных

DataType

Output arguments

# w — triangular window

+ column vector

Details

A triangular window returned as a column vector.

Examples

Triangular window

Details

Form a triangular window with 200 dots. Display the result using plot.

import EngeeDSP.Functions: triang
using Plots
w = triang(200)
plot(w,
     xlabel = "Sample Number",
     ylabel = "Amplitude",
     linewidth = 2,
     color = :blue,
     grid = true)

triang 1

Algorithms

The coefficients of the triangular window are equal.

For an odd value :

For an even value :

Literature

  1. Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1999.