How to detect rise and fall of a sparse signal?
2 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Wayne King
on 18 Mar 2013
Edited: Wayne King
on 18 Mar 2013
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!