use filtfilt with error of Not enough input arguments

13 views (last 30 days)
Hi all: I used fdatool designed a bandpass filter 'bp521',to filter my signal 'SINGAL', the main contents of the filter are below:
function Hd = bp521
% All frequency values are in kHz.
Fs = 90; % Sampling Frequency
Fstop1 = 3.5; % First Stopband Frequency
Fpass1 = 5.5; % First Passband Frequency
Fpass2 = 21; % Second Passband Frequency
Fstop2 = 23; % Second Stopband Frequency
Dstop1 = 0.001; % First Stopband Attenuation
Dpass = 0.057501127785; % Passband Ripple
Dstop2 = 0.0001; % Second Stopband Attenuation
flag = 'scale'; % Sampling Flag
% Calculate the order from the parameters using KAISERORD.
[N,Wn,BETA,TYPE] = kaiserord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 ...
1 0], [Dstop1 Dpass Dstop2]);
% Calculate the coefficients using the FIR1 function.
b = fir1(N, Wn, TYPE, kaiser(N+1, BETA), flag);
Hd = dfilt.dffir(b);
I can use filter(bp521,SIGNAL), but when I want to use it by filtfilt, it always gave error: 'Not enough input arguments.', so I wonder why?? could there anyone help me with this?
Thank you in advance!

Answers (1)

Honglei Chen
Honglei Chen on 30 Jul 2014
You can do the following:
bp521Coeff = coeffs(bp521);
filtfilt(bp521Coeff.Numerator,bp521Coeff.Denominator,SIGNAL)
  2 Comments
Miao
Miao on 30 Jul 2014
Thank you very much for your help, I tried, the bp521Coeff is a 1*1 struct, but there are nothing in bp521Coeff.Denominator?
Honglei Chen
Honglei Chen on 30 Jul 2014
oh, it's an FIR, so you just do
filtfilt(bp521Coeff.Numerator,1,SIGNAL)

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!