peak in fixed interval in findpeaks
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ARPITA MONDAL
am 28 Jul. 2020
Kommentiert: ARPITA MONDAL
am 28 Jul. 2020
How can I get peak in a fixed interval in findpeaks?
load("matlab_peak.mat") ;
x=V1_1_new ;
y=y1_1_new ;
[pks,idx] = findpeaks(y) ;
plot(x,y)
hold on
plot(x(idx),y(idx),'*r')
Here, I am getting 7 peaks but I want more peaks(11 peaks) ,Then what should I do?
x= V1_1_new is the voltage value in volt.
In x vs y plot if I want peak in every 30mv distance then what should I do?
1 Kommentar
Akzeptierte Antwort
dpb
am 28 Jul. 2020
There simply isn't much in the way of a peak to find -- I can't discern enough even by eye to count to eleven in that trace...
There's something funky going on with V1_1_new, though...
>> findpeaks(y1_1_new,V1_1_new)
Error using findpeaks
Expected X to be strictly increasing.
Error in findpeaks>parse_inputs (line 240)
validateattributes(Xin,{'double','single'},{'real','finite','vector','increasing'},'findpeaks','X');
Error in findpeaks (line 136)
= parse_inputs(isInMATLAB,Yin,varargin{:});
>> find(diff(V1_1_new)<=0)
ans =
248
316
>>
Rearrange in sorted order and you could help findpeaks out a little by detrend ing the trace to remove the overall rising trend.
>> [~,isrt]=sort(V1_1_new,'ascend');
>> [pks,idpk]=findpeaks(detrend(y1_1_new(isrt)),V1_1_new(isrt))
pks =
-0.2648
-0.6139
-0.6769
-0.6294
1.7529
1.4177
1.4740
1.6663
1.4735
1.4724
-0.1823
idpk =
3.8461
3.8832
3.8942
3.9044
3.9512
3.9637
3.9717
3.9809
3.9943
3.9953
4.0294
>>
Manages to find 10. Even visually I couldn't tell you where one would identify yet another...if do the above or something similar, would use the indices to go back and retrieve the original magnitudes if they are of interest.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!