Filtering out spikes in data at n*60 +1
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Emma Walker
am 29 Nov. 2021
Kommentiert: Emma Walker
am 29 Nov. 2021
Hello,
I have been working on a spectogram figure for some time now and have been unsuccessful in eliminating spikes in the data that occur at every 60 plus 1 i.e. 61, 121,181, ... etc. I have tried treating my data with a notch filter, filtfilt, medfilt1, and sgolay filt. In the past, I tried whitening it and using an fft to no advantage. Ideally, I would like to use something like butter or fir1 but this is a recorded data set with 64 channels and not a set frequency. What would be the best way to go about filtering this? Aside from the sgolay figure, the results are identical.
Sgolay: third order, framelength of 61
All of the other filters:
Below are the notch filters:
%% Notch Filter: Did not work
% method 1:
wo = 61/(30000/2); %removes 60Hz tome from a signal at 30,000 Hz
bw = wo/35; % Q factor of 35, this can be modified for varied results
[b,a] = iirnotch(wo,bw); % output's num and dom but we are not workign with a function to which they can be applied
% method 2: design butterworth notch filter
% d = designfilt('bandstopiir','FilterOrder',2, ...
% 'HalfPowerFrequency1',60,'HalfPowerFrequency2',62, ...
% 'DesignMethod','butter','SampleRate',samplingRate);
% dataFilt = filtfilt(d,lfp.data);
dataFilt = filtfilt(b,a,lfp.data);
Below are the other filters:
%% Median Filter: did not work
dataFilt = medfilt1(lfp.data,3);
%% Standard Filter: requires the inpouts of numerator and denominator functions 'filter(n,d,X)' where X is the data set, we are not trying to match this data to a filter
% did not work
dataFilt = filter(61,1,lfp.data); % the 1/1 is just a test
%% Savitzky - Golay Filter:
order = 3;
framelength = 61;
dataFilt = sgolayfilt(lfp.data, order, framelength);
%% FIR - Bandpass filter
dataFilt = fir1(lfp.data,60);
Thank you for taking a look at this. There must be a simple way to accomplish this.
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 29 Nov. 2021
If you know the indexes, how about just setting them to zero, or the median of neighboring values.
smoothy = movmedian(y, 5); % Smooth it
index = find(x == 181);
y(index) = smoothy(index); % Replace with median.
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Digital Filtering finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!