How do I type the code using Runge-Kutta?

12 visualizzazioni (ultimi 30 giorni)
Jacob Graves
Jacob Graves il 10 Dic 2018
Commentato: Steven Lord il 10 Dic 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 Commento
Steven Lord
Steven Lord il 10 Dic 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by