MATLAB Answers

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

116 views (last 30 days)
ARCHANA PATIL on 5 Feb 2019
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)


Sign in to comment.

Answers (1)

Omer Yasin Birey
Omer Yasin Birey on 5 Feb 2019
Edited: Omer Yasin Birey on 5 Feb 2019
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);
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.


madhan ravi
madhan ravi on 5 Feb 2019
Suspect OP wants to know what it does in signal processing , not what the syntax does.
Omer Yasin Birey
Omer Yasin Birey on 5 Feb 2019
Hard to tell with a single line code. Also after his edit it still seems like he wants to know what syntax does

Sign in to comment.

Sign in to answer this question.