Analytical Solutions to Differential Equations Matlab Help

Analytical Solutions to Differential Equations

In this section we introduce some important concepts and terminology associated with differential equations, and we develop analytical solutions to some differential equations commonly found in engineering applications. These solutions will give us insight into the proper use of numerical methods for solving differential equations. They also give us some test cases to use to check our programs.

Solution by Direct Integration

An ordinary differential equation (ODE) is an equation containing ordinary derivatives of the dependent variable. An equation containing partial derivatives with respect to two or more independent variables is a partial differential equation (PDE). Solution methods for PDEs are an advanced topic, and we will not treat them in this text.

A simple example of an ODE is the equation


Here the dependent variable is y, and t is the independent variable. We can solve for y by integrating both sides of the equation with respect to the independent variable t.


The solution is


You can always check your answer by substituting it into the differential equation and evaluating the solution at t = 0. Try this method for the preceding solution. It will be convenient to use the following abbreviated “dot” notation for derivatives.


Oscillatory Forcing Function

Now consider the following equation:


The function ƒ (t) is sometimes called the forcing function because it “forces” the solution to behave with a certain pattern. Let us see what this pattern is if the forcing function is sinusoidal ƒ(t) = sin wt. We can solve this case with the technique used earlier:


A Second-Order Equation

The order of a differential equation is the order of its highest derivative. Thus (8.4-1) is a first-order equation. The following is a second -order equation:


To solve it we must integrate twice. Integrating once gives


Integrating once more gives


The solution is yet) = t5 /2 0 + ty(0) + y(0). Note that because the ODE is second order, we need to specify two initial condition values to complete the solution; one of these is the value of the derivative at t =0.

Substitution Method for First-Order Equations

Consider the differential equation


where r is a constant and ƒ (t) is a given function. Linear equations can often be solved with the trial solution form y(t) = Ae”. Note that dy / dt = sAe Substitute this form into the differential equation with f(t) = 0 to obtain


For the solution to be general, Aes, cannot be 0 and thus we can cancel it out of the equation to obtain r s + 1 = 0.This equation is called the characteristic equation, and its root s = -1/ r is the characteristic root. To find A, we evaluate the solution form at t = 0. This evaluation gives y(0) = Aeo = A. Thus the solution is


This solution is called the free response because it describes the behavior or response of the process when the forcing function f(t) is 0; that is, when the process is “free” of the influence of f(t). The solution y(t) decays with time if t > 0.It starts at y(0) when t = 0, equals 0.02y(0) at t = 4r, and equals 0.01y (0) at 1 = Sr. Thus r gives an indication of how fast y(l) decays, and r is called the time constant.

Now suppose that f(t) = 0 for t < 0 and suddenly increases to the constant value M at t = O.Such a function is called a step function because its plot looks like a single stair step. The height of the step is M. The solution form for this case is y(t) = Aes, + B. The initial condition gives B = y(0) – A, and thus y(t) = Aes, + y(0) – A. Substituting this into the differential equation, we find that r s + I =0 and A = y(0) – M. The solution for y(t) is


The forced response is the term M (I-e), which is due to the forcing function. Thus we see that the total response for this equation is the sum of the free and the forced responses. Figure 8.4-1 shows the free and total response for the case where r = 0.1, y(0) = 2, and M = 10. Note that the free response is essentially 0 (1 percent of its initial value) for t > 5r = 0.5. Note also that the total response is essentially constant for t > 5r = 0.5. Thus the time constant tells us how long it takes for the free response to disappear and how long it takes for the total response to reach steady state.

Nonlinear Equations

Nonlinear ODEs can be recognized by the fact that the dependent variable or derivatives appear raised to a power or in a transcendental function. For example, the following equations are nonlinear:

      yy +5y + y = 0
y +sin y = 0
y+√y =0

Because of the great variety of possible nonlinear equation forms, no general solution method exists for them. Each class must be treated separately. Figure 8.4-1 Free and total step response of the equation 0.1y +y = 10, y(0) = 2.

Substitution Method for Second-Order Equations

Consider the second-order equation

      y – c² y = 0

If we substitute yet) = Ae into this equation, we obtain

(s² – c²)Ae = 0

which is satisfied for all values of t only if s² – c² = 0. This gives two values for the unknown constant s; namely, s = ±c. The general solution is


Note that the solution becomes infinite as t → 00 regardless of whether c is positive or negative. If the free response becomes infinite, the equation is said to be unstable. If the free response “dies out” (becomes 0), the equation is said to be stable. We need two initial conditions to determine the coefficients A1 and A2 For example, suppose that c = 2, and we are told that y(0) = 6 and y(0) = Then from (8.4-12), y(0) = 6 = A1 + A2, and y(0) = 2A1 – 2A2 = 4. The two equations have the solutions Al =4, A2 = 2.

The following second-order equation is similar to (8.4-11) except that the coefficient of y is positive.


Substituting y(t) = Aest into this equation.we find that the general solution is


This solution is difficult to interpret until we use Euler’s identities


If we substitute these two identities into (8.4-14) and collect terms, we would
find that the solution has the form


where B1 and B2 are constants that depend on the initial conditions and are BI = y(0) / w and B2 = y(0). The solution is


The solution oscillates with constant amplitude and a frequency of w radians per unit time. The period P of the oscillation is the time between adjacent peaks and related to the frequency as follows:


The frequency ƒ in cycles per unit time is given by ƒ = 1/ P.

The following equation is often used as a model of structural vibrations and some types of electric circuits.

my + cy + ky = ƒ (t)

Suppose for now that ƒ (t) = O.Substituting y(t) = Ae”, we obtain


which is satisfied for all values of t only if S² + cs + k = O.The characteristic roots here can fall into one of the following three categories:

  1. Real and distinct: S1 and S2.
  2. Real and equal: S1.
  3. Complex conjugates: s = a ± iω.

In the first case, the solution form is


These solutions can be obtained with the same methods used to solve the earlier equations. The values of the constants Ai and Bi, depend on the initial conditions.
Let us look at four specific cases .

  1. Real, distinct roots: Suppose that m = 1, c = 8, and k = 15. The characteristic roots are s = -3, -5. The form of the free response is
    The equation has two time constants, which are the negative reciprocals of the roots. They are t1 = 1/3 and t2 = 1/5. Note that the term e-5t disappears first and that it corresponds to the smallest time constant. The solution is essentially 0 after the term e-3t disappears. This term corresponds to the largest time constant. The time constant of this term is T = 1/3, so for most practical purposes the solution will be 0 after 5T = 5/3.
  2. Complex roots: Suppose that m = 1, c = 10, and k = 601. The characteristic roots are s = -5 ± 24i. The form of the free response is
    This solution will oscillate at a frequency of 24 radians per unit time, which corresponds to a period P = 2π /24 =π/12. The oscillations will disappear when the term e-5t disappears. The time constant of this term T == 1/5, so for most practical purposes the oscillations will disappear 5T = 5/5 = 1. Thus we should see approximately (5/5)/(π/12) ≈4 C) of the oscillations before they die out.
  3. Unstable case, complex roots: Suppose that m = 1, c = -4, and k = 20 The characteristic roots are s = 2 ± 4i. The form of the free response is
    This solution will oscillate at a frequency of 4 radians per unit time, Which corresponds to a period P = 2rr/4 = n /2. Because the term e²t increases with time, the oscillation amplitude also increases. Because the free response continues to increase, this case is said to be “unstable.” You can recognize an unstable linear equation by the fact that at least one of its characteristic roots will have a positive real part.
  4. Unstable case, real roots: Suppose that m = 1, c = 3, and k = -10. The  characteristic roots are s = 2 and s ‘7’ -5. The form of the free response is
    The solution will become infinite as t -+ 00 because of the e²t term. Thus
    the equation is unstable.

Figure 8.4-2 shows the response for each case the initial conditions y(0) = y(0) =0. In the next section we will show how to obtain these plots.

Figure 8.4-2 The free responses for the four cases discussed in the text.

Figure 8.4-2 The free responses for the four cases discussed in the text.

Test Your Understanding
.4-1 Find the form of the free response of the following equations:
a. y + lly +28y =0
b. Y +6y + 34y = 0
c. y-2y-15y=O
d. Y +6y – 40y = 0


The solutions obtained in this section can be used to check the results of a numerical solution technique. In addition, these solutions have also pointed out the following facts that will be helpful for properly using the numerical techniques presented in the next section.

  1. For certain types of differential equations, called linear equations, the characteristic polynomial can be found by making the substitution y(t) = Ae’.
  2. If any of the characteristic roots has a positive real part, the equation is unstable. If all the roots have negative real parts, the equation is stable.
  3. If the equation is stable, the time constants can be found from the negative reciprocal of the teal parts of the characteristic roots.
  4. The equation’s largest time constant indicates how long the solution takes to reach steady state.
  5.  The equation’s smallest time constant indicates how fast the solution changes with t.
  6. The frequency of oscillation of the free response can be found from the imaginary parts of the characteristic roots.
  7. The rate of change of the forcing function affects the rate of change of the solution. In particular, if the forcing function oscillates, the solution of a linear equation will also oscillate and at the same frequency.
  8.  The number of initial conditions needed to obtain the solution equals the order of the equation.

Posted on July 16, 2015 in Numerical Calculus And Differential Equations

Share the Story

Back to Top
Share This