Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Output Length of singal filtered using FIR Filters

Status
Not open for further replies.

jainsanket

Newbie level 2
Joined
Apr 20, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,302
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 M-1 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); %zero-phase 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?
 

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.
 
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.

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 co-efficients, 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.
 

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.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top