removing blink peaks from a signal
12 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Deepak Kumar
2019-12-31
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!