How do I type the code using Runge-Kutta?

14 visualizaciones (últimos 30 días)
Jacob Graves
Jacob Graves el 10 de Dic. de 2018
Comentada: Steven Lord el 10 de Dic. de 2018
Write a function that implements the classical Runge-Kutta fourth-order method for the case of a system of four equations with four unknowns. Use this function to solve the system:
x' = u; y' = v; u' = −2x + (3/2)y; v '= (4/3)x − 3y
subject to the initial conditions x(0) = −1, y(0) = 4, u(0) = 1, v(0) = 1. Use a step size ∆t = 0.01 and (a) Plot the values of the four variables as a function of time, each on a different plot, up to t = 15. (b) Plot u(t) (vertical axis) versus x(t) (horizontal axis) for the same range in t.
  1 comentario
Steven Lord
Steven Lord el 10 de Dic. de 2018
Since this sounds like a homework assignment, if you show us what you've written to try to solve the problem and ask a specific question about where you're having difficulty we may be able to offer some guidance.
If this isn't a homework assignment, just use the ODE solvers included in MATLAB, like ode45. Or if it is a homework assignment, use the results from ode45 to check your function's answer.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by