Finding the closed form of a recursive LTI system

In summary, finding the closed form of a recursive LTI system involves using the recursive formula to derive a general expression for the system's output. This allows for a more efficient and direct calculation of the output for any given input, without having to go through each individual step of the recursive process. The closed form solution can also provide insights into the behavior and stability of the system. This process is commonly used in various fields such as mathematics, engineering, and computer science.
  • #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:

CTukJxO.png


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?
 
Physics news on Phys.org
  • #2
kostoglotov said:

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.

I'm unfamiliar with the "signals and systems" approach to difference equations. From glancing at the notes

https://ocw.mit.edu/courses/electri...tems-fall-2011/readings/MIT6_003F11_chap2.pdf

https://ocw.mit.edu/courses/electri...tems-fall-2011/readings/MIT6_003F11_chap4.pdf

you are working exercise 23 of chapter 4.

If I assume ##x[n] = 0## and consider the problem as a homogeneous linear recurrence relation with constant coefficients (https://en.wikipedia.org/wiki/Recur...currence_relations_with_constant_coefficients )

Then we have the difference equation ## a[n] = 7 a[n-1] - 12 a[n-2] ##
This has characteristic polynomial ## p(t) = t^2 - 7t + 12 = (t-4)(t-3) ##
Which gives the general solution ## a[n] = k_14^n + k_23^n ##

So I don't understand how the ## 4^i - 3^i## in your code reconciles with the your initial condition ## f[1] = 7 ##, which, in my notation would be ##a[1] = 7 ##. To get ##a[1] = 7##, I would use ## k_1 = k_2 = 1## instead of ##k_1 = 1, k_2 = -1 ##.
 
  • #3
kostoglotov said:

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.
Above, your equation is ##y[n] = 7y[n-1]-12y[n-2]+x[n]##, but your code below uses ##y[n] = 7y[n-1]-12y[n-2]##; i.e., no x[n] term. Why do you have this descrepancy?
kostoglotov said:

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:

CTukJxO.png


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?
I believe the numbers you are seeing result from doing arithmetic on very large numbers, too large for the computer to represent exactly.
For example, when i = 46, f(i) is approx. 1.98 X 10^28, and 4 * 4 ^ 46 is a 29-digit number. For larger i, the values get even larger. From about i = 121, the ratio of the residuals are probably at the limit of the computer's ability to do precise division, which, I believe, leads to the oscillation that you're seeing.
 
  • Like
Likes kostoglotov
  • #4
If Mark44 is correct, you might try setting your initial conditions to 1 and 7 rather than 1.0 and 7.0. Python has a built in big integer class that I think it will use if you do that.
 
  • Like
Likes kostoglotov
  • #5
Mark44 said:
Above, your equation is ##y[n] = 7y[n-1]-12y[n-2]+x[n]##, but your code below uses ##y[n] = 7y[n-1]-12y[n-2]##; i.e., no x[n] term. Why do you have this descrepancy?

The x[n] is there as an impulse at time 0 and 1, at t = 0 the impulse is 1 and t = 1 the impulse is 7.

Code:
if n <= 0: return 1.0
if n == 1: return 7.0
 

1. What is a recursive LTI system?

A recursive LTI (Linear Time-Invariant) system is a type of mathematical model used to describe the behavior of a dynamic system, where the output depends not only on the current input but also on the past values of the input and output. It is characterized by a set of difference equations that relate the current input and output values to previous input and output values.

2. Why is finding the closed form of a recursive LTI system important?

Finding the closed form of a recursive LTI system allows us to obtain an explicit mathematical expression for the output of the system, which can be used for analysis and prediction. It also allows us to simplify the system and make it easier to understand and manipulate.

3. How do you find the closed form of a recursive LTI system?

The closed form of a recursive LTI system can be found by using various methods such as the Z-transform, Laplace transform, or state-space representation. These methods involve transforming the difference equations into a transfer function or state-space representation, which can then be used to obtain an explicit expression for the output.

4. Are there any limitations to finding the closed form of a recursive LTI system?

Yes, there are some limitations to finding the closed form of a recursive LTI system. These include the complexity of the system, the need for certain assumptions to be met, and the accuracy of the obtained closed form in representing the actual system. In some cases, it may not be possible to find a closed form due to the inherent nonlinearity of the system.

5. How can the closed form of a recursive LTI system be used in real-world applications?

The closed form of a recursive LTI system has various applications in fields such as engineering, physics, economics, and finance. It can be used for system identification, control and optimization, signal processing, and time series analysis. It is also used in the design and analysis of feedback control systems in industries such as aerospace, automotive, and manufacturing.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
864
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Engineering and Comp Sci Homework Help
3
Replies
80
Views
8K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
893
Back
Top