How do I type the code using Runge-Kutta?

12 Ansichten (letzte 30 Tage)
Jacob Graves
Jacob Graves am 10 Dez. 2018
Kommentiert: Steven Lord am 10 Dez. 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 Kommentar
Steven Lord
Steven Lord am 10 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by