MATLAB Answers

How to isolate one pulse from a periodic pulse train

13 views (last 30 days)
Hans123 on 20 Jun 2019
Commented: Star Strider on 20 Jun 2019
I want to isolate on pulse from this waveform, the data is in a CSV file and the 2 columns contain time data and voltage data.
I want to use a MATLAB code to trim out one full pulse (+peak,zero,-peak,zero)
How can I do this, the peak value is shown using the data cursor
Hans123 on 20 Jun 2019
If you can, can you explain a little further. I need only one pulse out of the 3 in the image. How can I isolate one pulse?

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 20 Jun 2019
One approach:
t = linspace(0, 2.3, 500); % Time Vector
pulses = -0.14*sign(sin(5*pi*t/2).*(abs(sin(5*pi*t/2))>0.9)) + rand(size(t))*0.005; % Create Waveform
Mv = pulses > 0.1; % Threshold
Mvs = strfind(Mv, [0 1]); % Start Of Each Pulse
Mve = strfind(Mv, [1 0])+1; % End Of Each Pulse
plot(t, pulses)
hold on
plot(t(Mvs(1):Mve(1)), pulses(Mvs(1):Mve(1)), '+')
hold off
Make appropriate changes to work with your signal.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!