The DE is of the form :
where
must not equal zero.
To use MATLAB filter we set up the row vectors :
and the input row vector
If we now call filter with : y=filter(b,a,x) the output y is computed for the times at which
the inputs x are specified but zero initial conditions are assumed.
To specify initial conditions an initial condition vector v0 say must be determined from the initial conditions y(-1),y(-2),...,y(-N) according to the following rule :
For filter v0 needs to be a column vector :
Then call filter with y=filter(b,a,x,v0) .
Example :
Find the output of the system described by the DE :
for the case where the input x(n)=u(n) and the initial conditions are y(-1)=-1 y(-2)=-2
and y(-3)=-3 .
Calculate the IC vector :
MATLAB script :
n=0:1:40;
a=[1 -0.25 -0.125 0.5];
b=[3];
v0=[1.0;0.875;0.5];
x=[ones(size(n))];
y=filter(b,a,x,v0);
plot(n,y,'o');