Applying a Notch-filter to filter my MEP-data
Show older comments
Hi everyone,
I've been trying to apply a 50 Hz Notchfilter to my data (Motor evoked potentials) for some time but I can't get it to work.
One example of what I've tried is this:
Fs = 5000 %Sampling frequency is 5000 Hz
t = (0:length(trialtime)-1)/Fs; % My trace is 400 ms long
plot(t,trialdata(:,1))
d = designfilt('bandstopiir', 'FilterOrder',2,'HalfPowerFrequency1',49,'HalfPowerFrequency2',51,'DesignMethod','butter','SampleRate',Fs);
fvtool(d,'Fs',Fs)
buttLoop = filtfilt(d,trialdata(:,1));
plot(t,trialdata(:,1),t,buttLoop)
However, doing this I get the following error:
Warning: SOS structures not supported for FieldTrip drop-in filtfilt
Usage: y=filtfilt(b,a,x)
Whatever other way of filtering I try, it always comes back to using the filtfilt function and I get the error above.
It must have something to do with the size of b but I don't understand how to correct this or where it goes wrong.
function y = filtfilt(b, a, x)
if (nargin ~= 3)
error('Usage: y=filtfilt(b,a,x)');
end
if (min(size(b)) > 1)
warning('SOS structures not supported for FieldTrip drop-in filtfilt');
error('Usage: y=filtfilt(b,a,x)');
end
My data looks as following:
trialdata = array of my datapoints (voltage change)
trialtime = time array over which the voltage change is measured
plot(trialtime,trialdata) looks like this:

Accepted Answer
More Answers (0)
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
