How to detect rise and fall of a sparse signal?

4 次查看(过去 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?

采纳的回答

Wayne King
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 个)

类别

Help CenterFile Exchange 中查找有关 Measurements and Feature Extraction 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by