MATLAB: Remove PPG noise

biosignal processingdenoisingoutlier removal

How to remove the noise in the circle?

Best Answer

I don't know what you were doing with the detrend(), butter(), and filtfilt() filters in your m file, like if they were supposed to get rid of the large negative going spikes or they were for something else. But to get rid of the spikes you can use either filloutliers (to replace them with estimated "good" values), or rmoutliers (to delete them completely and make the array shorter).
Or you can use simple masking:
badIndexes = (y < -1000); % If y is less than -1000, we'll define it as "bad" and will get rid of it.
y(badIndexes) = []; % Setting to null removes those elements from the vector, giving a shorter vector.
You can attach the text file 'P0037.txt' if you need anymore help.
Related Question