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
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
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)
M1 = 25744×4
-58.6100 39.0700 -76.1600 76.5100 86.3700 -65.8000 -100.8600 45.4900 141.8900 -77.1100 -80.2800 28.9500 131.6100 -55.5200 -63.8100 18.6100 75.0600 -6.1700 -52.4900 17.5800 -101.7900 115.1500 -38.0800 44.4600 -256.0200 218.9900 13.3800 29.9800 -273.5000 270.4000 23.6700 0 -175.8200 229.2700 -2.0600 -8.2700 -83.2800 127.4900 34.9900 -1.0300
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!

Translated by