There's nothing wrong with your change to a system. It'll work fine. You now need to figure out, in the RK4 method, what quantities are vectors and what quantities are scalars, and what's what.
What is your f?
1. The problem statement, all variables and given/known data
In aerodynamics, one encounters the following initial value problem for Airy’s equations:
y''(x) + xy = 0, y(0) = 1, y'(0) = 0
Using the Runge-Kutta method with h=0.005 and determine values between x=0 and x=10 sufficient to sketch the relationship.
2. Relevant equations
y''(x) + xy = 0, y(0) = 1, y'(0) = 0
I think,
k1 = h*f(Xn, Yn)
k2 = h*f(Xn+h/2, Yn+k1/2)
k3 = h*f(Xn+h/2, Yn+k2/2)
k4 = h*f(Xn + h, Yn + k3)
3. The attempt at a solution
From what I have read you cant do second order ODE using runge kutta without breaking it into a system of first order ODEs so thats what I tried.
I tried:
d2y/dx2 + xy = 0
dy/dx = z, y(0) = 1
dz/dx + xy = 0
dz/dx = -xy, z(0) = 0
I dont know if that is right or not and if it is I have no idea where to go from here.
Thanks for any help.
I am doing this all in MATLAB, This is what I have come up with but I am not sure if this is correct or not.
Attached are my MATLAB code, a Graph of the results, and an excel sheet of all results.
the matlab code can be opened in notepad.
Thanks for any help.
MEA Proj.zip
Ok, from what you've typed, I see three problems (or one problem, depending on how you look at it). You should have this:
and
and
instead of what you have. The only difference is that I'm taking the second component of k at the far right of each equation. You did this correctly for and but not for the rest.
Everything else looks good to me.