How to detect rise and fall of a sparse signal?

1 回表示 (過去 30 日間)
John
John 2013 年 3 月 18 日
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 Center および File ExchangeCorrelation and Convolution についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by