Appendix A: DiscreteTime Simulation of Feedback Loops 

Consider two transfer functions arranged in a feedback loop as shown below 


By the methods described in previous sections we can determine the following two recurrence formulas for the two individual transfer functions: 

_{} 

We also have the equation for the summing junction 

_{} 

Together these three formulas define the dynamic relationship between x_{n} and y_{n}. However, they cannot be executed as written, because the computation of y_{i} by equation (A1) requires the value of w_{i}, and the computation of w_{i} by equation (A3) requires the value of z_{i}, but the computation of z_{i} by equation (A2) requires the value of y_{i}, which is what we are trying to find. 

A simple approach to simulating this system would be to approximate the summing junction equation by 

_{} 

In other words, w_{i} would be computed as the current value of x minus the past value of z. However, in some circumstances, especially when x changes rapidly, this approximation can lead to unrealistic and even unstable results. 

To overcome this problem it is necessary to “solve” the complete set of loop equations simultaneously. We’ll first show how this is done for loops in which all the piecewise relationships are linear functions (as in the preceding example), and then we will show how this approach can be modified to accommodate nonlinear functions. 

Assuming all the functions in the loop are linear, we rewrite equation (A1) for y_{i}, and eliminate all appearances of w_{i} by substituting from equation (A3), which gives 

_{} 

The corresponding equation for y_{i}_{}_{1} is 

_{} 

Also, equation (A2) can be written for the times t_{i}_{}_{2}, t_{i}_{}_{1}, and t_{i} as follows 

_{} 

Equations (A5) through (A9) constitute five equations in the five unknowns z_{i}_{}_{3}, z_{i}_{}_{2}, z_{i}_{}_{1}, z_{i}, and y_{i}. Solving these equations simultaneously gives the following recurrence formula for y_{i}: 

_{} 

where 

_{} 

_{} 

Now suppose the firstorder lead/lag in the above example were replaced by an arbitrary function F of y, that is 

_{} 

Substituting this into equation (A5) and rearranging terms gives the equation 

_{} 

At each application of this (implicit) recurrence formula we are given the values of y_{i2}, y_{i1}, x_{i2}, x_{i1}, and x_{i}, so the right side of (A12) can be computed (assuming F is computable). Given this value, which we will denote as V_{i}, equation (A12) is simply 

_{} 

Depending on the form of the function F, this equation may or may not be explicitly solvable for y_{i}. In any case, it can be solved numerically to any desired degree of precision. 

If the arbitrary function F is inserted into the feedback loop in series with (rather than in place of) the dynamic function, the resulting set of equations can still be reduced to essentially the same form as (A13). Consider the feedback loop shown below. 



By substituting F(y_{n}) for y_{n} in equations (A7), (A8), and (A9), we can solve the five equations (A5) through (A9) for y_{i} to give 

_{} 

The right hand side of this equation consists entirely of “given” information. If we call the right hand value V_{i} then the recurrence formula is 

_{} 

As in the case of equation (A13), this equation may or may not be explicitly solvable for y_{i}, but a numerical solution of any desired precision can be computed. Notice that the execution frequency of the algorithm must be high enough so that the values of y_{n} occur close enough together so that the discrete values of F(y_{n}) provide an adequate definition of the actual function F(y(t)). 
