필터 지우기
필터 지우기

how to interpret this expression?

조회 수: 4 (최근 30일)
KJDS SRINIVASA RAO
KJDS SRINIVASA RAO 2013년 5월 23일
Could you please put the braces for this expression. I mean does this expression mean
a) a( N - winLength * 2 : N )=0; this
1) a( N - ( winLength * 2 ) : N ) = 0; or
2) a( ( N - winLength ) * 2 : N ) = 0;
n the same with this expression also
b) a ( 1 : winLength * 2 ) = 0;
1) a ( 1 : ( winLength * 2 ) ) = 0; or
2) a ( (1 : winLength ) * 2 ) = 0;

채택된 답변

David Sanchez
David Sanchez 2013년 5월 23일
Let us suppose
a = [1 2 3 4 5 6 7 8]; winLength = 3; N = 7;
- a( N - winLength * 2 : N )=0 -> elements from N-winLength*2 till element N is zero: N-winLength*2 = 7-3*2=1 -> a(1:7)=0 a = [0 0 0 0 0 0 0 8]
- a( N - ( winLength * 2 ) : N ) = 0 -> same than above
- a( ( N - winLength ) * 2 : N ) = 0 -> (N-winLength)*2=(7-3)*2 =4*2=8 -> a(8:7) -> this produces an empty matrix for the example presented, but I'm sure you can think about any other example.
- a(1:winLength*2) = 0 is the same than a(1:(winLength*2)) = 0 -> a(1:3*2) = a(1:6) = [1 2 3 4 5 6]
- a((1:winLength)*2) = a((1:3)*2) = a(1:3)*2 = [2 4 6]

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by