필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How can I get a matrix B of the indexes in a matrix A that satisfy the following —i representing index— A(i-1)>0 && A(i+1)<0?

조회 수: 1 (최근 30일)
How can I get a matrix B of the indexes in a matrix A that satisfy the following —i representing index— A(i-1)>0 && A(i+1)<0?
Im ploting an oscillating graph, and would like to get indexes of rate of change closest to 0, in order to get the frequency.

답변 (2개)

Star Strider
Star Strider 2017년 12월 24일
‘Im ploting an oscillating graph, and would like to get indexes of rate of change closest to 0, in order to get the frequency.’
You might find Curve fitting to a sinusoidal function (link) helpful.
If you want to find the indices of the zero-crossings of your data, this little utility function could help:
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0); % Returns Approximate Zero-Crossing Indices Of Argument Vector

Roger Stafford
Roger Stafford 2017년 12월 25일
B = find(A(1:end-2)>0 & 0>A(3:end)) + 1;
Note that the "+1" is necessary here. For example. if A(1)>0 and A(3)<0, we would want to get an index of 2 included in B, but without the "+1" 'find' would record it as an index of 1.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by