Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Work on Ralstons method in Matlab for solving first order Ordinary Differential Equation (ODE) in any civil engineering problem for the fields such as: structural

Work on Ralstons method in Matlab for solving first order Ordinary Differential Equation (ODE) in any civil engineering problem for the fields such as: structural engineering, mechanics, earthquake engineering, water resource engineering, foundation engineering and so on.
Note: Please give me matlab code and civil enginering problem stroy and work on ralston method (Runge kutta) attached example question and code..
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Heun Method with a Single Corrector (Q2 = 1/2). If ay is assumed to be 1/2, Eqs. (25.34) and (25.35) can be solved for a = 1/2 and p =qu = 1. These parameters, when substituted into Eq. (25.30). yield (25.36) where ky = f(x, y) (25.36a) k2 = f(x; + h. y + kih) (25.36b) Note that ki is the slope at the beginning of the interval and ky is the slope at the end of the interval. Consequently, this second-order Runge-Kutta method is actually Heun's tech- nique without iteration The Midpoint Method (a2 = 1). If an is assumed to be 1, then a = 0, p = 91 = 1/2, and Eq. (25.30) becomes (25.37) Yi+1 = yi + kyh where k = f(x,y:) (25.37a) = 1 ++) ; (25.37b) This is the midpoint method. Ralston's Method (a2 = 2/3). Ralston (1962) and Ralston and Rabinowitz (1978) determined that choosing a2 = 2/3 provides a minimum bound on the truncation error for the second-order RK algorithms. For this version, a = 1/3 and p = 911 = 3/4 and yields Yi+1 = y + k + (25.38) where k = f(x, y) (25.38a) ki (25.38b) Comparison of Various Second-Order RK Schemes Problem Statement. Use the midpoint method (Eq. (25.37) and Ralston's method [Eq. (25.38)] to numerically integrate Eq. (PT7.13) RUX, Y) = -2x + 12x - 20x + 8.5 from x = 0 to x = 4 using a step size of 0.5. The initial condition at x=0 is y= 1. Com- pare the results with the values obtained using another second-order RK algorithm, that is. the Heun method without corrector iteration (Table 25.3). Solution. The first step in the midpoint method is to use Eq. (25.37a) to compute ki =-20) + 12002 - 2000) + 8.5 = 8.5 However, because the ODE is a function of xonly. this result has no bearing on the second stepthe use of Eq. (25.37b) to compute k2 = -20.25) + 120.25)2 - 20(0.25) + 8.5 = 4.21875 Notice that this estimate of the slope is much closer to the average value for the interval (4.4375) than the slope at the beginning of the interval (8.5) that would have been used for Euler's approach. The slope at the midpoint can then be substituted into Eq. (25.37) to predict y(0.5) = 1 + 4.21875(0.5) = 3.109375 = 3.4% The computation is repeated, and the results are summarized in Fig. 25.14 and Table 25.3. FIGURE 25.14 Comparison of the five solution with numerical solutions using three secondorder RK methods and Euler's method Analytical Euler Heun Midpoint Ralston 2 TABLE 25.3 Comparison of true and approximate values of the integral of y = -2x + 12x2 - 20x+ 8.5, with the initial condition that y= 1 at x=0. The approximate values were computed using three versions of second-order RK methods with a step size of 0.5. Second-Order Heun Midpoint Ralston RK true leil (%) leil (%) Terl (%) 0.0 1.00000 1.00000 0 1.00000 0 1.00000 0 0.5 3.21875 3.43750 6.8 3.109375 3.4 3.277344 1.8 1.0 3.00000 3.37500 12.5 2.81250 6.3 3.101563 3.4 1.5 2.21875 2.68750 21.1 1.984375 10.6 2.347656 2.0 2.00000 2.50000 25.0 1.75 12.5 2.140625 7.0 2.5 2.71875 3.18750 17.2 2.484375 8.6 2.855469 5.0 3.0 4.00000 4.37500 9.4 3.81250 4.7 4117188 2.9 3.5 4.71875 4.93750 4.6 4.609375 2.3 4.800781 17 40 3.00000 3.00000 0 3 0 3.031250 1.0 000 5.8 O For Ralston's method, k for the first interval also equals 8.5 and [Eq. (25.38b)] k2 = -2(0.375)? + 12(0.375)2 - 20(0.375) +8.5 = 2.58203125 The average slope is computed by 1 (8.5) + (2.58203125) = 4.5546875 ) + | which can be used to predict y(0.5) = 1 +4.5546875(0.5) = 3.27734375 E, = -1.82% The computation is repeated, and the results are summarized in Fig. 25.14 and Table 25.3. Notice how all the second-order RK methods are superior to Euler's method. SUB RK4 (x, y, h, ynew) CALL Derivs(x, y, kl) ym = y + kl. h/2 CALL Derivs(x + 7/2, ym, k2) ym = y + k2 . 1/2 CALL Derivs(x + h/2, ym, k3) ye = y + k3.h CALL Derivs(x + h, ye, k4) slope = (kl + 2(K2 + (3) + (4)/6 ynew = y + slope. h x = x + h END SUB 25.4 SYSTEMS OF EQUATIONS 741 (a) Main or "Driver" Program Assign values for in = number of equations yi = initial values of n dependent variables xi = initial value independent variable xf = final value independent variable dx = calculation step size xout = output interval X = x m = 0 DOFOR 1 = 1, yp:= yf y = y1 END DO DO xend = x + xout IF (xend > xf) THEN Xend = xf n = dx CALL Integrator (x, y. n. , xend) m = m + 1 x = X DOFOR 1 = 1. n YP.. END DO IF (x 2 xf) EXIT END DO DISPLAY RESULTS END (b) Routine to Take One Output Step SUB Integrator (x, y, n, H. xend) 00 IF (xend - *

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions