Hello,
I tried to code a Butterworth filter 4th order by using designfilt and then used the function filtfilt to apply it on my 3-dimensional EEG data.
But I'm getting an error, that the Data length must be larger than 12 samples, even though the length is larger…
I think I must be missing something. Can somebody help me?
So the size of the EEG data is "8x5121x30 double" and is called "ssvep0Hz". The passband is set between 5Hz and 20Hz. The sample_rate in this case is 512.
- This is the code I programmed:
function [filtered_signal] = myfilter(n,f1,f2,ssvepdat,samp_rate)
d = designfilt('bandpassiir', 'FilterOrder', 2*n, 'HalfPowerFrequency1', f1, 'HalfPowerFrequency2', f2, 'DesignMethod', 'butter', 'SampleRate', samp_rate);
filtered_signal = filtfilt(d,ssvepdat);
end
- And then implemented in the script it looks like that:
filtered_ssvep0Hz = myfilter(2,5,20,ssvep0Hz, sample_rate);
Thank you in advance.
Best Answer