Calculate peak of pulses above certain threshold
4 views (last 30 days)
Show older comments
Can you please guide how can I find the first peak of each pulse and its location. I use the peak command but peak time consider oscillations aslo. As seen in figure that each pulse decays in certain time. I just want to take in account the first rise of each pulse above any threshold value during a time duration 't' 

Accepted Answer
Mathieu NOE
on 11 May 2022
hello
@Chunru : why the envelop ? this can create enough signal distorsion so that the peak instant is misread. I understand that some signal filtering could help remove spurious peaks
even simpler code :

load example.mat
figure;
plot(C);
findpeaks(C,'MinPeakDistance',1000, "MinPeakHeight",0.005); % doc findpeaks for more options
2 Comments
Mathieu NOE
on 11 May 2022
hello again
ok - yes I recognize it can help in some cases. But it's sometimes tricky to find a way to smooth / envelop a signal with very sharp peaks without some time distorsion / shift of the peak
I believe evry situation is special and you have to try different solutions . here we see envelop works fine because the signal is quite nice - not abrupt and noisy as in the post.
More Answers (1)
Chunru
on 11 May 2022
load example.mat
%whos
plot(C(19e5:20e5));
% compute envelope before findpeaks
env = envelope(C, 1000, 'peak');
hold on
plot(env(19e5:20e5));
figure;
findpeaks(env); % doc findpeaks for more options
hold on;
plot(env)
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!