Explore BrainMass

Matlab : Euler Formula and Runga-Kutta Fourth Order

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

I am posting formula called Runge Kutta Fourth Order. This formula need to be written in a matlab program.

I attached sample program how to generate euler formula in mathlab. Based on this program, can any one send matlab program for Runga Kutta Fourth Order?

See attached files for full problem description.

© BrainMass Inc. brainmass.com October 24, 2018, 9:11 pm ad1c9bdddf


Solution Preview

I am assuming that the fun.m.txt is the function you wanted to implement. Any other function
which finds (dy/dt) = y' = f(t,y) could be substituted . For example if you change f(t,y) as follows to get a solution for y' = y - t^2 + 1 (as in the problem in the book)

function z =f(t,y)
z = y - t^2 + 1
The function is given below. This is a as is implementation of the algorithm in the book

To use it save it as runga.m , open and type runga(a,b, N , ...

Solution Summary

The Euler Formula is formulated as a Runga-Kutta Fourth Order problem in Matlab.