The Dormand–Prince method for ODEs Version 1
|
02-18-2024, 01:01 PM
Post: #1
|
|||
|
|||
The Dormand–Prince method for ODEs Version 1
The Dormand–Prince method for ODEs Version 1
The Dormand–Prince method is more accurate than the Runge–Kutta–Fehlberg method and it is used by the MATLAB ode45 solver. NOTE: Make sure you supply the ODE function with a clear matrix that returns the columns of x and y values. The parameters of function ODE are: 1. The parameters x0 and y0 represent the initial integration point. 2. The parameter xf is the final x value where integratin stops. 3. The parameter h is the integration step. 4. The parameter hmin is the minimum integration step. 5. The parameter hReduceFactor is the reducion factor for the integration step h. 6. The parameter toler is the error tolerance for the variable y. 7. The parameter resMat is the matrix that returns the columns of sampled x and y values. 8. The parameter skipSampling specifies the number of (x, y) point to exclude from appearing in the resMat matrix. To include all point supply an argument of zero. To skip a sequence of n points supply an argument of n. The function uses an IF statement to ensure that (xf, y) is included in the resMat matrix. The function returns the matrix resMat populated with (x, y) values. Example ======= To integrate fx(x,y) = x+y from (1,2) to xf = 2 in steps of 0.01, minimum step of 0.001, step reduction factor of 2, tolerance of 1e-6, and sampling all values of (x, y): M1 := ODE(1,2,2,0.01,0.001,2,1e-6,M1,0) The program creates a matrix with x,y data. The last value of y at x=2 is calculate as 7.87312731391. Reference ========= Mathematical Modeling in Chemical Engineering, by Anders Rasmuson, Bengt Andersson, Louise Olsson, and Ronnie Andersson, published by Cambridge University Press 2014. See page 89. Program Listing =============== Code: EXPORT fx(x,y) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)