explain computation of P2(1:L/2+1)
조회 수: 16 (최근 30일)
이전 댓글 표시
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)
댓글 수: 0
답변 (1개)
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
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
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 Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!