How do I solve the following system of differential equation numerically by fourth order Runge-Kutta method?

Suppose I have two dependent variable y_1 and y_2 and one independent variable x. The system is
[dy_1/dx = y_1 + dy_2/dx; dy_2/dx = -x*dy_1/dx] where y_1(0)=1 and y_2(0)=0
with the range of x=0:0.1:5. I am facing problem due to the term dy_2/d_x in the first equation. How does we vary this term in each step of Runge-Kutta method and finally get a numerical solution which match with the analytical solution of the system? Please help.

Answers (1)

Solve for dy_1/dx and dy_2/dx as functions of x, y_1 and y_2.
Then apply the Runge-Kutta scheme.
I get
dy_1/dx = y_1/(1+x)
dy_2/dx = y_1*(-x/(1+x))
Best wishes
Torsten.

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Asked:

on 6 Oct 2015

Answered:

on 6 Oct 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!