MATLAB Answers

# FIR filter has output of same length as its input?

1 view (last 30 days)
Nader Rihan on 27 Dec 2020
Commented: Nader Rihan on 27 Dec 2020
If the input signal has length L samples, impulse repsonse has length M samples, entering these L samples to FIR filter using conv function, will get L+M-1 output samples, while entering these L samples to FIR fitler, the output has L samples only instead of L+M-1 samples . Also, I'd like to know which L samples does FIR filter choose from L+M-1 samples (total samples) to be its output ?.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

Bruno Luong on 27 Dec 2020
Edited: Bruno Luong on 27 Dec 2020
There is the the difference equation in the "Rational Transfer Function" part of the doc. x(i) with i<=0 are supposed to be 0.
and you can figure out easily just by experiment
>> x=rand(1,10)
x =
0.1576 0.9706 0.9572 0.4854 0.8003 0.1419 0.4218 0.9157 0.7922 0.9595
>> b=rand(1,3)
b =
0.9340 0.6787 0.7577
>> conv(x,b) % <= 'full' option
ans =
0.1472 1.0135 1.6722 1.8385 1.8022 1.0435 1.0966 1.2491 1.6810 2.1277 1.2515 0.7270
>> filter(b,1,x)
ans =
0.1472 1.0135 1.6722 1.8385 1.8022 1.0435 1.0966 1.2491 1.6810 2.1277
##### 1 CommentShowHide None
Nader Rihan on 27 Dec 2020
Thanks

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!