+ Post New Thread
Results 1 to 4 of 4

21st April 2011, 23:30 #1
 Join Date
 Apr 2011
 Posts
 2
 Helped
 0 / 0
 Points
 298
 Level
 3
Output Length of singal filtered using FIR Filters
Hello Experts,
The output of the FIR filters is convolution of the input signal and the filter kernel. In that case, the length of the output signal should be greater than input signal by M1 points where M is the length of the filter kernel.
x=ecg(500)'+0.25*randn(500,1); %noisy waveform
h=fdesign.lowpass('Fp,Fst,Ap,Ast',0.15,0.2,1,60);
d=design(h,'equiripple'); %Lowpass FIR filter
y=filtfilt(d.Numerator,1,x); %zerophase filtering
y1=filter(d.Numerator,1,x); %conventional filtering
In the above code, the length of the output is same as the length of my input signal even though I have implemented FIR filtering.
Can someone explain the reason of same length of the output signal? I expected my output signal to be greater than input signal.
Does MATLAB use convolution for filtering?

21st April 2011, 23:30

22nd April 2011, 03:05 #2
 Join Date
 Jul 2010
 Posts
 923
 Helped
 294 / 294
 Points
 5,700
 Level
 17
Re: Output Length of singal filtered using FIR Filters
help filter
I expect if you read the docs, you'll find some option to get the extra samples at the end (for the FIR case). likewise there's probably an option to provide initial conditions for IIR filters.
1 members found this post helpful.

22nd April 2011, 03:05

22nd April 2011, 03:35 #3
 Join Date
 Apr 2011
 Posts
 2
 Helped
 0 / 0
 Points
 298
 Level
 3
Re: Output Length of singal filtered using FIR Filters
Thank you for your reply permute. I saw the help for both filtfilt and filter. None of them share any information with respect to FIR filters (Although, they show the example I posted before). Also, I am trying to understand the conceptual difference between those written in DSP texts and those obtained from Matlab and other software packages.
For IIR, I believe there is no convolution taking place. Its combination of multiplications and additions between coefficients, past outputs, past and present inputs to calculate present output. Hence, the same length of the output is expected.
For FIR, since the operation is convolution, I am expecting a longer output. But, I am sure MATLAB is correct. Hence, I need to know my mistake conceptually.

22nd April 2011, 03:35

22nd April 2011, 05:21 #4
 Join Date
 Jul 2010
 Posts
 923
 Helped
 294 / 294
 Points
 5,700
 Level
 17
Re: Output Length of singal filtered using FIR Filters
both FIR and IIR perform the convolution operation. IIR filters have an impulse response that is infinitely long. The filter operation probably just returns the output as the same length as the output to be consistent in both the IIR and FIR cases.
you can also do things like append zeros to the end of the data, or append the first samples. Then you can see the expected response for convolution or cyclic convolution.
1 members found this post helpful.
+ Post New Thread
Please login