How to use findpeaks for a matrix of size A

54 ビュー (過去 30 日間)
navan
navan 2015 年 5 月 27 日
コメント済み: Star Strider 2015 年 5 月 28 日
I have a matrix of 4*8. I would like to find out the no of peaks in each row,with a condition that peak value-minimum value >1000.How should i do it.I have tried following code, but not working. i have tried [peaks]=findpeaks(A),but not working.

採用された回答

Star Strider
Star Strider 2015 年 5 月 27 日
The findpeaks function will work, but you have to cycle through the rows:
M = randi(99, 4, 8);
for k1 = 1:size(M,1)
[pks,loc] = findpeaks(M(k1,:));
P{k1} = [pks; loc];
end
The cell array accounts for different numbers of peaks and locations in each row.
  6 件のコメント
navan
navan 2015 年 5 月 28 日
I want to go one more step deep into the problem. finding the no of peaks in each row with a specific condtion (that is ) peakvalues with (peakvalue-minvalueof each row>1000)
Now i take a single row for easiness.In reality i have a big matrix.
A= [1000 8000 1000 1800 1200 4000 4800 4000 1000 1000]
the min-value of A=1000 The peak values of A= [8000 1800 5000], But the problem here is if i use ordinary threshold limit& findpeak
findpeaks(A,'Threshold',1000)
it will only compare with the values near to it.
I want to find out the total number of peaks which obey my condition (i.e>1000) in detailed way
8000-1000 >1000 (true) 1800-1000<1000(false) 5000-1000>1000(True)
so the aswer i expect peakswithcondition=2 I have also posted this as different question. Kindly see the link below
Star Strider
Star Strider 2015 年 5 月 28 日
Answered in your different Question.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by