y[n + 2] + 2 y[n + 1] + y[n] = 0with y[-1] = 1 and y[-2] = 1, the Mathematica code to compute the general form of the solution follows:
Needs[ "DiscreteMath`Master`" ]; RSolve; ysols = RSolve[ { y[n + 2] + 2 y[n + 1] + y[n] == 0, y[-1] == 1, y[-2] == 1 }, y[n], n ]Note that the second statement, RSolve, will force the recursive (difference) equation solver to be loaded. This would normally not be needed in Mathematica, but it is here to work around a bug in the RSolve package. You can use the solution to the difference equation to compute the values of y[n] for n = 0, 1, 2, 3, 4:
Apply[Join, Table[ ysols, {n, 0, 4} ] ]
For the zero-input case in continuous time, characteristic modes have the form of eg t for continuous-time systems (where g is a characteristic root) and an for discrete-time systems (where a is a characteristic root). In both cases, the characteristic modes are exponentials:
an = eb n = (eb) n
So, a = eb, i.e. b = ln a.
Let's consider the three possible cases for the zero-input solution for a positive real value of a:
Because the system in linear and time-invariant, the initial conditions must be zero. This means that the zero-input solution must be zero. The zero-state solution is simply the convolution of the input and impulse response.
In this problem, the form of the impulse response matches the general form of the system response. We can then compute the impulse response by setting the input equal to an impulse and iteratively calculating h[0], h[1], etc. For the impulse response, we know that the initial conditions are zero, i.e. h[-1] = 0 and h[-2] = 0. From the calculated values of the impulse response, we can solve for the constants in the general form of the impulse response.
Part (c) is quite similar to problem 1.5 on midterm #1.
The system has one distinct characteristic root. The general form of the system response is a weighted version of the characteristic mode. We can then solve for the zero-input solution using the initial condition given.
The form of the impulse response matches the general form of the system response. We can then compute the first impulse response value by setting the input equal to an impulse. For the impulse response, we know that the initial condition is zero, i.e. h[0] = 0. From the calculated value of the impulse response at h[1], we can solve for the constant in the general form of the impulse response.