554 C H A P T E R 9: The Z-Transform
To solve the difference equation witha=0.8,x[n]=u[n]−u[n−11], and zero initial condition
y[−1]=0, using MATLAB, we use the following script.%%%%%%%%%%%%%%%%
% Example 9.16
%%%%%%%%%%%%%%%%
N = 100; n = 0:N - 1; x = [ones(1,10) zeros(1,N - 10)];
den=[1 -0.8]; num = [1 0];
y = filter(num, den,x)The functionfilterrequires that the initial conditions are zero. The results are shown in Figure 9.11.Let us now find the impulse responseh[n] of the system. For that, letx[n]=δ[n] andy[−1]=0,
then we havey[n]=h[n] orY(z)=H(z). Thus, we haveH(z)=1
1 −az−^1so that h[n]=anu[n]0 5 10 15 20 25 30012345x[n]0 5 10 15 20 25 30
0246(a)n(b)ny[n]FIGURE 9.11
(a) Solution of the first-order difference equation with (b) input.