How to detect rise and fall of a sparse signal?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a signal where at certain points, it rises from 0 and goes back down to 0 for a given peak. I need the indices of the first point on the rise and the last point before it goes down to 0
For example, there's 3 peaks in this signal.
[ 0 0 0.1 0.2 0.3 0 0 0.3 0.4 0 0 0.5 0.7]
1st set of indices would be 3, 4, and 5 2nd set of indices would be 8, 9 3rd set of indices would be 12 and 13.
Keep in mind that if we are are at the beginning of the signal or the end of the signal, we just grab those indices as well similar to this example
Is there a function that can do this in Matlab?
댓글 수: 0
채택된 답변
Wayne King
2013년 3월 18일
편집: Wayne King
2013년 3월 18일
If it really always goes from 0 and returns to zero. You can use
idx = find(x>0);
You can then look at the diff() of those points to determine where there are jumps of greater than 1.
For example,
jumpidx = find(diff(idx)>1);
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!