I read that Matlab filter command is used to solve difference equations. Does filter() internally use z-Transform or does it simply use recursion, that is, with a starting value x(0),y(0), it simply runs the difference equations forward in time? Sorry if this question does not make sense, I am new in this field.
Thanks,
Filter implementation is likely some clever usage of frequency-domain techniques, however according to MATLAB documentation, it is mathematically equivalent to solving a difference equation:
Y = FILTER(B,A,X) filters the data in vector X with the filter described by vectors A and B to create the filtered data Y. The filter is a "Direct Form II Transposed" implementation of the standard difference equation: a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb) - a(2)*y(n-1) - ... - a(na+1)*y(n-na)The initial conditions are picked to be all zero, since we assume simply absence of signal (all zeros) before we start filtering. If you would like to specify those initial conditions, the
filtercommand allows you to specify vectors of initial (Zi) and final (Zf) conditions:[Y,Zf] = FILTER(B,A,X,Zi)