Filtering nose and removing spikes at local areas
26 views (last 30 days)
Show older comments
I am working on a project related to "Gait in Neurodegenerative Disease" using the PhysioNet database. I am looking for ways to improve data filtering for more accurate analysis. Currently, I am encountering notches in the data, typically at the beginning or middle of a recording, which I believe are caused by the subject turning around at the end of a hallway. I would like to locaclized these points, but they are at different indices in every other csv files in the database. Is there any method that would better suit this?
Thank you to whoever helps.
als1 = readtable('als1.csv','PreserveVariableNames',true);
left = als1{:,2};
right = als1{:,3};
time1 = als1{:,1};
fs = 300;
te = 1/fs;
t = (0:length(time1)-1)*te;
t = t(6000:80000);
left = left(6000:80000);
right = right(6000:80000)
figure;
plot(t,left);
title('Original Signal');
%% Check for frequency range
y = fft(left);
p2 = abs(y/(length(left)));
p1 = p2(1:(length(left)/2+1));
p1(2:end-1) = 2*p1(2:end-1);
l = length(left);
f = fs*(0:(l/2))/l;
figure;
plot(f,p1);
title('Single-Sided Amplitude Spectrum of Signal')
xlabel('Frequency (Hz)')
ylabel('|P1(f)|')
%% Remove DC offset
signal_cen = (left - mean(left));
plot(t,signal_cen);
hold on
%% first noise filter
gait_signal = signal_cen;
windSize = 30;
filtered_signal = movmedian(gait_signal,windSize);
plot(t,filtered_signal);
title('median filter signal');
%% Second noise filter
[b,a] = butter(4, 0.3/(fs/2),'low');
gait_low = filtfilt(b,a,filtered_signal);
plot(t,gait_low);
title('Final filter data');
0 Comments
Answers (2)
Star Strider
on 10 Nov 2024 at 13:42
The findpeaks function may be an option, however it defines a peak as having a lower values on each side of it, so it will not pick up isolated transients if they are the beginning and end values of the signal. It will be necessary to pad the signal with a zero at each end to detect those with findpeaks.
Use the 'MinPeakProminence' name-value pair to specifically select for the spikes. The findpeaks funciton can also output the prominence values of the original signal, so it may be appropriate to do that first before setting the prominence value. Otherwise, just experiment with the prominence value until you get the result you want.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!