How to Smooth signal data to find clean peaks
4 次查看(过去 30 天)
显示 更早的评论
Hello, I wanted to know how to make the signal that I get (image 1) smooth as in image 2. There are 20 peaks I need to find but want to do it clean as image 2.
I have implemented the code (Fatiga.m) but I don't know what is wrong.
I attach the data file (Zip file) in case they can help me
Thank you so much
2 个评论
John D'Errico
2023-2-26
If you are seriously hoping to smooth curves as noisy as that, into nice smooth virtual sine waves with well defined peaks, good luck. Your data is very sparsely sampled compared to the noise in it, so what your eye sees as a nice periodic behavior is less obvious to a computer.
采纳的回答
Star Strider
2023-2-26
I am not certain what you want.
One option is simply to use a lowpass filter, then adjust the ‘CutoffFreq’ variable until you are happy with the result. (I arbitrarily cose a 1 Hz sampling frequency, since neither that nor a time vector was provided.) The essence of that is that the ‘CutoffFreq’ value must be greater than 0 and less than 0.5.
Experiment with it to get the result you want —
% file = websave('Fatiga','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1307815/Fatiga.m')
% type(file)
Uz = unzip('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1307820/S17_6.ASC.zip');
% Te = readcell(Uz{1}, 'FileType','text')
% Te(20:30,:)
M1 = readmatrix(Uz{1}, 'FileType','text', 'HeaderLines',38);
M1 = M1(:,2:end)
x = (1:size(M1,1)).';
CutoffFreq = 0.0175;
M1_Filt = lowpass(M1, CutoffFreq, 1, 'ImpulseResponse','iir');
figure
plot(x,M1_Filt)
grid
xlim([0 1E+3])
.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!