- #1
kostoglotov
- 234
- 6
Homework Statement
Find the closed form of the impulse response of the system [itex]y[n] = 7y[n-1]-12y[n-2]+x[n][/itex] using the peel away and guess method. Ie, by using Python code to find the geometric ratios and amplitudes of the outputs as n grows large, then calculate residuals, and find the geometric ratios and amplitudes of the residuals, and so on.
Homework Equations
The Attempt at a Solution
[/B]
This is the code:
Code:
memo = {}
def f(n):
if n <= 0: return 1.0
if n == 1: return 7.0
if n in memo: return memo[n]
memo[n] = 7*f(n-1) - 12*f(n-2)
return memo[n]
# residual
def g(n):
return f(n) - 4*4**n
for i in range(1,500):
print i, ": ", f(i)
# this closed form found from transfer function
print i, ": ", 4*4**i - 3*3**i
I was able to find an exact matching closed form for the system from performing partial fraction decomposition on the transfer function H(z) and then doing inverse Z-Transform on that...but I did this as a last resort.
My problem was that when I check the ratio of the residuals, when n gets above 127, the ratios of the residuals don't stabilize, they oscillate.
This code:
Code:
for i in range(1,500):
print i, ": ", g(i)/g(i-1)
produces this output at large n:
imgur link: https://i.imgur.com/CTukJxO.png
I spent a long time trying to reconcile this in a closed form. As you can see, this pattern goes [itex]4*1.05^{-1}, 4*1.05^0, 4*1.05^1, 4*1.05^0,...[/itex]. This seemed very messy.
Of course, the real closed form is simple enough when figured out from the transfer function, it's [itex]y[n]= 4*4^n - 3*3^n[/itex].
And below n = 127, the ratio of the residuals seems to want to settle around 3, so guessing 3 at that point would be fine.
Why are the residuals oscillating like that? Why doesn't it affect or appear in the actual closed form? How would one go about making a judgement on which value for the geometric ratio of the residuals to guess? If I had kept going with the later oscillating ratios of the residuals, wouldn't I have to introduce imaginary numbers?