3. DiscreteTime Simulation of SecondOrder Response 

3.1 Background 

This section treat the discretetime simulation of any continuous dynamic relationship of the form 

_{} 

where x is the independent variable, y is the dependent variable, t is time, and the coefficients a_{1}, b_{1}, a_{2}, and b_{2} are real constants (with a_{1} not equal to zero). 

It may appear at first that this type of relationship could be simulated simply by means of two firstorder lead/lags in series, as illustrated by Figure 3a, where D denotes the differential operator. Combining these two (simplistically) gives the secondorder transfer function shown in Figure 3b. 


Identifying the coefficients of this function with those of equation (3.11) gives 

_{} 

Solving these equations for t_{1} through t_{4}, we have 

_{} 

Notice that if 4a_{1} is greater than b_{1}^{2} (meaning that the response is underdamped), then t_{2} and t_{4} are not real numbers. It follows that first order lead/lags with real coefficients cannot be combined to give an underdamped secondorder response. (This corresponds to the fact that in electrical circuits an oscillating response cannot be produced by any passive arrangement of resistors and capacitors.) Also, if 4a_{2} is greater than b_{2}^{2}, then t_{1} and t_{3} have nonzero imaginary parts. Thus, unless the function to be simulated is overdamped in both directions (i.e., with either x or y regarded as the dependent variable), it cannot be simulated by a combination of first order functions with real coefficients. Of course, firstorder algorithms can be written to accommodate complex coefficients and variables (noting that the intermediate vairable z in Figure 3 can be complex) and this approach can be generalized to reduce linear differential equations to a set of firstorder differential equations, but for embedded code it is often desirable to avoid complex arithmetic. Furthermore, in discretetime implementations the combination of two firstorder simulation algorithms in series does not give the optimum representation of the corresponding product of continuous firstorder functions (see Section 3.3). 

The optimum recurrence formula for secondorder response is presented in Section 3.2 based on the exact analytical solution of equation (3.11) with specific interpolation assumptions for the input variable. 
