Thursday 31 May 2018

SECOND-ORDER DIFFERENCE EQUATIONS - DIRECT METHOD


EDITOR: B. SOMANATHAN NAIR


Since difference equations are modifications of differential equations, we can expect similar solutions in the case of second-order difference equations, where we have to substitute the term an for the term et. Consider the second-order difference equation

                        y(n) + ay(n‒1) + by(n‒2) = 0  (1)
                                             

The characteristic equation of this difference equation can be written as

                                                            (C2 + aC + b)y = 0       (2)                                                  

where we have used C2 y = y(n), and so on. The roots of this equation, as in the case of differential equations, can be taken as α and β and depending on the values of these, we have four possible solutions to Eq. (2) as given below.

Solution I: Both a and b exist and are real and unequal

In this case, both the roots are real and unequal. That is the roots are α ± β. The solution can be written in a way similar to that given in Eq. (4) of solution to differential equation as


                                                y(n) = A(α + β)n + B(αβ)n  (3)
                                                                     

Solution II: Both the roots are real and equal

In this case, only α exists, β. = 0. The solution can be written similar to that given in Eq. (5) as


                                    y(n) = αn(A + Bn)  (4)                                                        

Solution III: Both the roots have real and imaginary parts

The roots are α ± , and the solution can be written similar to that given in Eq. (6) as                                       

                                                y(n) = A(α + )n u(n)+ B(α)n u(n)  (5)
           
Equation (5) may be manipulated mathematically to yield its trigonometric form                     

                        y(n) = rn‑(C cos nθ + D sin )   (6)                   

where we have used the new constants C = A+B and D = j(A−B). 
                                                                                                                                                                                                                     
Solution IV: Both the roots are imaginary and are equal to ± jb
The solution can be written in a form similar to that given in Eq. (6). Thus, we have

                        y(n) = C cos nb + D sin nb   (7)           
                                                          

In the forthcoming blogs, we illustrate the solutions of differential and difference equations using typical numerical examples.


SECOND-ORDER DIFFERENTIAL EQUATIONS - DIRECT METHOD


EDITOR: B. SOMANATHAN NAIR

We have already seen the method for solving the first-order differential and difference equations. We now consider the methods for solving the second-order differential and difference equations. First we consider second-order differential equations of the form

                                                (d2y/dt2) + p(dy/dt) + qy = 0  (1)

where we have assumed the forcing function to be zero. The characteristic equation of this differential equation can be written as                                                                                                          
                                                   (D2 + pD + q)y = 0  (2)

where we have made the substitution D = d/dt. The quadratic given in the brackets has the roots

                                                          D1, D2 = α ± β  (3)                                       

where α = p/2 and β = (½)√(p2‒4q). It may be noted that α, called attenuation constant, introduces attenuation in the output wave form and β, called phase constant, produces phase delay in it. Depending on the values of α and β, we have four independent solutions of Eq. (2).

Solution 1: Both a and b are real and unequal
When both α and β are real, the roots from Eq. (2) are (α+β) and (αβ), respectively. These roots can be seen to be real and are unequal. Using them, the solution can now be written as

                        y = Ae(α+β)t + Be(αβ)t   (4)                                 

where A and B are the constants of integration. Equation (4) represents a damped single vibration, as shown in Fig. 1. Here α represents the damping in the vibration produced and β produces the delaying action in it.



Solution 2: Only a exists; b = 0
In this condition, both the roots are real and equal. This means that the system output has only attenuation and there is no propagation. The solution may be written in the form

                                    y = eαt (A+ Bt)   (5)                                                  

which represents a single damped vibration of duration shorter than that shown in Fig. 1. The duration of the vibration becomes shorter since there is no propagation as b = 0. The resulting waveform, called critically damped waveform, is shown in Fig. 2.


 

Solution 3: Both a and b exist; a real, b imaginary
The roots are a +jb and ajb, respectively. So, the solution can be written in a form similar to that given in Eq. (4), which yields

                                    y = Ae(α+)t + Be(αβ)t   (6)                              
                                     
Equation (6) may be expressed in the form           
            y = eαt(Aejβt +Bejβt)= eαt(C cosbt + D sinbt)  (7)                       

where we define the new constants of integration  as C = A+jB and D = A‒jB. We find that Eq. (6) represents a damped oscillation, as shown in Fig. 3.


 

Solution 4: a = 0 and only b exists
Both the roots in this case can be seen to be purely imaginary, and are equal to ±jb. The solution, therefore, can be written by modifying Eq. (6), which yields

                                     y = Aejβt + Bejβt = C cosbt + D sinbt  (8)
                       
This represents undamped pure sinusoidal oscillations (see Fig. 4).



 

                                                                                            










Tuesday 29 May 2018

FIRST-ORDER DIFFERENTIAL AND DIFFERENCE EQUATIONS


EDITOR: B. SOMANATHAN NAIR


1. INTRODUCTION
In many of the engineering problems, we come across first and second order differential and difference equations. Hence, we must have a thorough knowledge of how to solve them. This blog deals with the method of solving first-order differential and difference equations.
Consider Fig. 1, which shows a straight line passing through the origin. The slope of this line is given by the equation 

                                                                  m = tan α = y/t    (1)

The slope m can be found to be a constant in this case since both y and t are constants. Once we know the value of m, we can get the function y back from Eq. (1) as

                                                                        y =mt       (2)

            Next consider Fig. 2, which shows a slowly (or, gradually) varying curve. In this case, as shown in the figure, the slope is varying in short segments of straight lines. Hence the value of m is constant during these small segments only. It can be seen that the value of m varies from segment to segment. In this condition, we can express the function as a difference equation in the form

                                                                  m = Δyt      (3)

where Δt  is a small interval of time over which the slope remains constant and Δy is the change in the function y over this interval.  From Eq. (3), we can get the function Δy back by using the equation

                                                                  Δy = m Δt     (4)

Equation (4) gives the value Δy of one segment only. For finding out the total value of y, we have to add (or sum up) the values of Δy’s of all the individual segments. Thus, we obtain
                                                                  
                                    ­y = m1 Δt + m2 Δt + ···+ mn Δt = ∑I =1n mi Δt (5)

where m1, m2, …, mn represent the slopes of the individual segments. Equation (5) is the general form of difference equation.                                                       


       
 As a final step in this discussion, let us consider Fig. 3, which shows a continuously varying curve exhibiting a continuously varying slope m. We can express this type of continuous variation in the form of a differential equation:

                                                                    m = dy/dt   (6)                                                         

where dt represents an infinitesimally small (tending to zero) interval of time and dy represents the corresponding change in amplitude y. From Eq. (6), we can get back the elemental function dy as

                                                                        dy = m dt   (7)
                                                                                                                                     

From Eq. (7), we get the function y back from dy using the integral

                                                                     y = ∫m dt    (8)

We know that the dynamic behavior of an analog system is governed by one or more differential equations. By dynamic behavior of a system, we mean the behavior of the system under actual loading or operating conditions.
            The purpose of this blog is to introduce a few typical methods by which differential and difference equations can be solved systematically. For this, we first discuss the methods of solving differential equations, and then extend the principles evolved therein for the solution of difference equations. In this text, we shall be dealing with the first- and second-order differential and difference equations only.

2.    DIRECT SOLUTION OF FIRST-ORDER DIFFERENTIAL EQUATIONS

Consider the first-order differential equation

                                                            dy/dt + py = q  (9)

where y = y(t) is a function of time and p and q are constants.
The solution of Eq. (9) has two parts. One part of the solution is known as the transient solution (also known as complementary function), and the other part is known as the steady-state solution (also known as particular integral). The transient part is governed by the differential equation

                                          dy/dt + py = 0  (10)                                                     

using the variable-separable method, we find

                                                                    dy/y = pdt  (11)                                   

Integrating both sides of Eq. (2.11) produces the result
                                                           
                                                                   ln y = ‒pt + ln A (12)

where ln A is the constant of integration. Rearranging Eq. (12), we get

                                                                  ln (y/A)= ‒pt  (13)

Taking antilog of Eq. (13) yields the transient solution as
                       
                                         ytrans = A exp(‒pt) (14)

The solution given by Eq. (14) represents the functioning of the system immediately after it has been switched-on.
            After the transient situation dies out, the system enters into its steady-state condition. The second part of the solution shows this condition. This solution can be obtained from the knowledge of the steady-state condition of the system. We can also find the solution using an expression, which can be derived as follows.
Consider Eq. (9) again. Multiply both sides of this equation by exp (At), which yields

                                    exp (pt) (dy/dt) + py[exp (pt)] = q [exp (pt)]  (15)
                                                         
We find that the LHS can be represented as d[y exp (pt)]/dt, because
                                                                                            
                                d[y exp (pt)]/dt = exp (pt)(dy/dt) + py [exp (pt)] (16)

Using the LHS of Eq. (16), we replace the expression on the LHS of Eq. (15) yields

              d[y exp (pt)]/dt = q exp (pt)  (17)   

                     
 Integrating both sides of Eq. (17) gives

y exp (pt) = ∫q exp (pt) dt + A (18)            

where A is a constant of integration. Multiplying both sides of Eq. (18) with the expression exp (‒pt)], we get

                               y = exp (‒pt)∫q exp (pt) dt + A exp (‒pt) (19)    
                                                                               
Equation (19) gives the complete solution of a first-order differential equation. The complete solution can be seen to contain two parts. The first part on the RHS, viz., exp (‒pt)∫q exp (pt) dt, gives the steady-state solution and the second part, viz., A exp (‒pt), gives the transient solution.  

Example 1:  Obtain the solution of the equation

                                                              dy/dt + 3y = 5    (i)                                                     

Solution:  Comparing Eqs. (9) and (i), we find p = 3 and q = 5. Therefore, using the solution given in Eq. (19), we obtain
                                                                                      
          y = exp (‒3t)∫5 exp (3t) dt + A exp (‒3t) (ii) 

Solving Eq. (ii) yields

                   y = 5/3 + A exp (‒3t) = 5/3 + Ae‒3t (iii)                                                                                                
where 5/3 is the steady-state solution and Ae‒3t is the transient solution. and By knowing the initial conditions, we can evaluate the constant A. A similar method may be used for the solution of first-order difference equations.

 3. DIRECT SOLUTION OF FIRST-ORDER DIFFERENCE EQUATIONS

Consider the first-order difference equation                                        

                                                 y(n) ‒ ay(n‒1) = x(n), a < 1   (20)

In Eq. (20), y(n) represents the output function, y(n‒1) represents y(n) delayed by one unit time interval, and x(n) represents the input function. It may be noted that y(n‒1) is equivalent to dy/dt, since differentiation of the function y(n) means delaying it by one unit of time. Similarly, we find that y(n‒2) is equivalent to d2y/dt2, y(n‒3) is equivalent to d3y/dt3, and so on. The term a is an arbitrary constant whose value is chosen to be less than unity in Eq. (20).

            Now, to get the transient part of the solution of Eq. (20) we assume that at n = 0, ay(n‒1) = 0. we also assume that the input at n = 0 is an impulse function and it is this impulse that produces transient in the system. Thus, x(0) = d(0) = 1, where d(0) is an impulse function at t = 0.   Using these assumptions, we find from Eq. (20) that

                                           y(0) = 1  (21)                                                            

Now, when n = 1, using Eqs. (20) and (21), we obtain

                                  y(1) = ay(1‒1) = ay(0) = a  (22)                                         

Following the procedure given above, when n = 2, we have

                              y(2) = ay(2‒1) = ay(1) = a2  (23)          
                                            
and when n = 3,
                           y(3) = ay(2‒1) = ay(1) = a3  (24)                                              

This may be generalized to yield the transient solution

                          y(n) = ay(n‒1) = anu(n)  (25)                   

where u(n) is unit step function. Multiplication of an by u(n) indicates that an varies from 0 to ∞ (i.e., only positive values). Incorporating the constant of integration in the solution, we find the transient solution as

                                      ytr(n) = Aanu(n)  (26)                                                       
           
We find that the solution given by Eq.(26) is similar to the transient solution given in Eq. (iii) of Example 1, where we have replaced an with e3t. In mathematics this is called homogeneous solution. The particular (steady-state) solution is obtained depending on the applied forcing function. The following example illustrates this idea.

Example 2:     Obtain the solution of the difference equation

                                                        y(n) ‒ (½)y(n‒1) = u(n)    (i)                               

Solution: The transient part of the solution is

                                ytr(n) = A(½)nu(n)    (ii)                                                                

            To get the steady-state solution, we find that the forcing function on the right-hand side of Eq. (i) is the constant u(n) = 1. So, assuming that in the steady-state condition the system will reach a constant or fixed value, let us choose y(n) = K, another constant. Then, from Eq. (i), we find

                                      K‒ (1/2) K = u(n) = 1      (iii)

where we have used y(n – 1) also equal to K. Equation (iii) gives the value of K as

                                        K = 2 = yss(n)     (iv)
                                                              
Using this, we get the total solution as

                                                y(n) = yss(n) + ytr(n) = A(½)nu(n) + 2    (v)
                                                                                                 (5)

To evaluate A, from Eq. (i) we find y(0) = 1, since at n = 0, u(0) = 1. Using this in Eq. (v), we get

                                    y(0) = 1 = A+2 (vi)                                                                   

From Eq. (vi), we find

                                             A = ‒1 (vii)                                                                     
Thus the complete solution is
                       
                      y(n) =2 (½)nu(n)    (viii)
                                                                         

            In the next blog, we shall discuss the solutions of second-order differential equations.

DISCRETE SIGNAL OPERATIONS

EDITOR: B. SOMANATHAN NAIR 1. INTRODUCTION In the previous two blogs, we had discussed operations of scaling and shifting on conti...