explain computation of P2(1:L/2+1)

16 ビュー (過去 30 日間)
ARCHANA PATIL
ARCHANA PATIL 2019 年 2 月 5 日
コメント済み: P Sun 2021 年 6 月 10 日
What exacly does P2(1:L/2+1) this
where L is length of signal and P2 is two sided spectrum
P1 = P2(1:L/2+1)

回答 (1 件)

Omer Yasin Birey
Omer Yasin Birey 2019 年 2 月 5 日
編集済み: Omer Yasin Birey 2019 年 2 月 5 日
It takes one more element than half of it. Let's say your array is
P2 = [1 2 5 6 7 8 9];
L = length(P2);
P2(1:L/2+1)
the output of this will be
[1 2 5 6]
Because the length is 7 and (7/2+1) will be 4 (it is 4 because for odd numbers it will round down the result of dividing operation). And it will take until 4th element.
  3 件のコメント
Omer Yasin Birey
Omer Yasin Birey 2019 年 2 月 5 日
Hard to tell with a single line code. Also after his edit it still seems like he wants to know what syntax does
P Sun
P Sun 2021 年 6 月 10 日
Well, I know neither and it is great to know the syntax part.
This line from intro of fft https://uk.mathworks.com/help/matlab/ref/fft.html

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

カテゴリ

Help Center および File ExchangeParametric Spectral Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by