removing blink peaks from a signal
Show older comments
Does anyone know how to program a system to be developed that automatically isolates all the blinks (large peaks) from a signal and saves the cleaned signal to a specific variable. And then how to plot the signal before and after blink isolation alongside with their spectrum (before/after) and save the spectrums to specific variables.
Thank you
Answers (1)
Deepak Kumar
on 31 Dec 2019
You can use "findpeaks" function in MATLAB to final the local maxima (peaks) of the input signal vector. The below documentation link gives the detailed description about "findpeaks" function.
The below example code snippet extracts the peak from the signal and plot them before and after peak extraction. In the code I have extracted the peaks from the signal and subtracted it from the original signal. So the peak values are now replaced by zeros.
fs=1000; %Sampling frequency
t=0:1/fs:1; %time vector
y=10*sin(2*pi*10*t); % Input Signal
figure(1)
plot(t,y) % Plot the signal before peak extraction
[pks,locs] = findpeaks(y); % returns a vector with the local maxima (peaks) of the input signal y and the indices at which the peaks occur.
x=zeros(size(y));
x(locs)=y(locs);
z=y-x; %Cleaned Signal
figure(2)
plot(t,z) % Plot the signal after peak extraction
You can use "FFT" function in MATLAB to find the spectrum of the signal. The below is the documenation link for the "FFT" function.
1 Comment
rami zaboura
on 7 Aug 2020
can anyone approve this answer?
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!