triang
Triangular window
Description
Examples
Create a 200-point triangular window. Display the result usingwvtool.
L = 200;w = triang(L);wvtool(w)

Input Arguments
Window length, specified as a positive integer.
Note
If you specifyL as noninteger, the function rounds it to the nearest integer value.
Data Types:single |double |int8 |int16 |int32 |int64 |uint8 |uint16 |uint32 |uint64
Since R2024b
Output data type (class), specified as one of these:
"double"— Use this option to return a double-precision outputw."single"— Use this option to return a single-precision outputw.
Data Types:char |string
Output Arguments
Triangular window, returned as a column vector.
Algorithms
The coefficients of a triangular window are:
ForL odd:
ForL even:
References
[1] Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck.Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1999.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced before R2006aThetriang function supports single-precision outputs.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)