Is the really a correct way to check if a filter is an FIR filter?

1 view (last 30 days)
I found the following function in Matlab. It checks if a filter is has FIR. It basically checks that there is only one non-zero output term at at the first index. Is it really general? It is possible to design FIR filters with more than one non-zero output term.
function isfirflag = isfirisfir(b,a)
%ISFIR(B,A) True if FIR.
if nargin<2, a=[]; end
if isempty(a), a=1; end
if ~isvector(b) || ~isvector(a)
error(message('signal:signalpolyutils:InvalidDimensions'));
end
if find(a ~= 0, 1, 'last') > 1,
isfirflag = 0;
else
isfirflag = 1;
end
  1 Comment
Daniel M
Daniel M on 14 Nov 2019
Edited: Daniel M on 14 Nov 2019
It seems that this is what freqz() does internally to check for FIR filters too.

Sign in to comment.

Answers (0)

Products


Release

R2014a

Community Treasure Hunt

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

Start Hunting!