Are MATLAB's window functions incorrect (starting at n = 1 instead of n = 0)?

1 回表示 (過去 30 日間)
Miles Henrichs
Miles Henrichs 2019 年 3 月 20 日
回答済み: Jan 2019 年 3 月 20 日
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 件のコメント
Rik
Rik 2019 年 3 月 20 日
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
Bjorn Gustavsson 2019 年 3 月 20 日
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

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2019 年 3 月 20 日
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?

カテゴリ

Help Center および File ExchangeBartlett についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by