Are MATLAB's window functions incorrect (starting at n = 1 instead of n = 0)?
1 view (last 30 days)
Show older comments
According to Wikipedia's page on window functions, the first value of most of these functions should be 0. For example, triangular windows are defined for 0 <= n <= N - 1.
In contrast, MATLAB's windowing functions (I'll use triang() as an example) define the window for 1 <= n <= N.
triangular_window = triang(10); % first value is 0.1, not 0
Is this incorrect? If not, why?
2 Comments
Rik
on 20 Mar 2019
I suspect this has something to do with Matlab being a 1 index language, instead of 0 index (which is the majority of the programming languages).
Bjorn Gustavsson
on 20 Mar 2019
Have a look at all the values. Compare with triang(9). Think about what contribution first and last-element with zero in them would contribute to in filtering and whether you need to drag those through the calculations...
HTH
Answers (1)
Jan
on 20 Mar 2019
The documentation is clear in this point: https://www.mathworks.com/help/signal/ref/triang.html#bt6p4f0
The triangular window is very similar to a Bartlett window. The Bartlett window always ends with zeros at samples 1 and L, while the triangular window is nonzero at those points.
w(n) = (2*n-1) / L for 1<=n<=L/2
Does this clarify your question?
0 Comments
See Also
Categories
Find more on Bartlett in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!