I am trying to calculate the output of a LTI system. I came across two different Matlab functions that are supposed to be appropriate for the job: filter
and conv
. What is the difference between the two of them?
filter
can handle FIR and IIR systems, while conv
takes two inputs and returns their convolution. So conv(h,x)
and filter(h,1,x)
would give the same result. The 1 in filter indicates that the recursive coefficients of the filter are just [1]
. But if you have an IIR filter, you can't use conv
. filter
can also return the filter states, so that it can be used in subsequent calls without incurring filter transients.