find pulsed trigger events
I had the problem of needing to find an unknown number of pulses in a signal, but I knew the pulse rate and the approximate length of the pulses (but there could be some missing). This function has a trigger with downtime functionality and will find all events with a given trigger level.
% Example 1
% generate signal with two pulses of random noise:
sig = [zeros(1,200) .5-rand(1,20) zeros(1,200) .5-rand(1,20)];
fs = 440;
level = .02;
prate = 2;
triggerindex = get_trigger(sig, level, fs, prate, 'r');
% make it visible:
figure;
plot(sig); hold on
plot(triggerindex, sig(triggerindex), 'or')
I wrote this some time ago and I know it could be made more efficient, but for the signal lengths I'm dealing with it works okay. But feel free to post some improvements.
Cite As
Deborah (2025). find pulsed trigger events (https://www.mathworks.com/matlabcentral/fileexchange/42227-find-pulsed-trigger-events), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Signal Processing > Signal Processing Toolbox > Measurements and Feature Extraction > Descriptive Statistics >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |