Iterative Solution to a Second-Order Difference Equation
Solve iteratively
y[n+2]-y[n+1]+0.24 y[n]=x[n+2]-2 x[n+1]
with initial conditions y[-1]=2, y[-2]=1 and a causal input x[n]=n u[n]. The system equation can be expressed as
y[n+2]=y[n+1]-0.24 y[n]+x[n+2]-2 x[n+1] (3.19)
Setting n = −2 in Eq. (3.19) and then substituting y[−1] = 2, y[−2] = 1, x[0] = x[−1] = 0, we obtain
y[0] = 2 − 0.24(1) + 0 − 0 = 1.76
Setting n=−1 in Eq. (3.19) and then substituting y[0] = 1.76, y[−1] = 2, x[1] = 1, x[0] = 0, we obtain
y[1] = 1.76 − 0.24(2) + 1 − 0 = 2.28
Setting n = 0 in Eq. (3.19) and then substituting y[0] = 1.76, y[1] = 2.28, x[2] = 2, and x[1] = 1 yield
y[2] = 2.28 − 0.24(1.76) + 2 − 2(1) = 1.8576
and so on.
With MATLAB, we can readily verify and extend these recursive calculations.
>> n = -2:5; y = [1,2,zeros(1,length(n)-2)]; x = [0,0,n(3:end)];
>> for k = 1:length(n)-2,
>> y(k+2) = y(k+1)-0.24*y(k)+x(k+2)-2*x(k+1);
>> end
>> n,y
n = -2 -1 0 1 2 3 4 5
y = 1.0000 2.0000 1.7600 2.2800 1.8576 0.3104 -2.1354 -5.2099