Findout the peaks in each row of matrix with specific conditions

7 vues (au cours des 30 derniers jours)
navan
navan le 28 Mai 2015
Commenté : Star Strider le 30 Mai 2015
i would lime to find out 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

Réponse acceptée

Star Strider
Star Strider le 28 Mai 2015
Does this do what you want?
A= [1000 8000 1000 1800 1200 4000 4800 4000 1000 1000];
[pks,loc] = findpeaks(A-1000);
pksvct = (pks>1000);
pks = pks(pksvct) + 1000
loc = loc(pksvct)
It first subtracts 1000 from ‘A’, finds the peaks, finds the peaks the meet your criterion, then reports the actual value of the ‘acceptable’ peaks and their locations.
  6 commentaires
navan
navan le 30 Mai 2015
Dear strider great. It resolved my issue thanks a lot again.
Star Strider
Star Strider le 30 Mai 2015
My pleasure!
Happy we got it sorted.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by