Dear,
I am trying to build a bandstop filter to get ride of 50Hz, below is my code:
%% build filter
N = 20; % Order
F3dB1 = 49; % First
F3dB2 = 51; % Second
Fs = 1000; % Sampling Frequency
h = fdesign.bandstop('n,f3db1,f3db2', N, F3dB1, F3dB2, Fs);Hd = design(h,'butter');%[B, A] = sos2tf(Hd.sosMatrix,Hd.scaleValues);
fvtool(Hd); %% test data
fs = 1000;t = 0:1/fs:5-1/fs;x = cos(2*pi*50*t)+cos(2*pi*100*t);fdata=filtfilt(Hd,double(x)); % call filtfilt failed. use filter() instead.
When I run the last statement, I got some error message:
Error using filtfilt (line 17)Not enough input arguments.
If I change it to filter(HD, double(x)), then everything all right.
what's going on here? why I can't call filtfilt?
Best Answer