Filter löschen
Filter löschen

Matlab code for Euler's method

4 Ansichten (letzte 30 Tage)
Sam
Sam am 7 Mär. 2014
Kommentiert: Sam am 7 Mär. 2014
This is my first time using matlab and I need to know matlab code for this IVP where
y' = 3y, y(1) = 2, 1=<t=<2, h = 0.5. Solve the system with Euler's method.

Antworten (1)

James Tursa
James Tursa am 7 Mär. 2014
Bearbeitet: James Tursa am 7 Mär. 2014
Look at this link:
Look at the "Formulation of the method" and "Example" sections.
Simply replacing their example with your specific derivatives, you should be able to program this up in just a few lines of code.
  3 Kommentare
James Tursa
James Tursa am 7 Mär. 2014
Here is the example copied directly from the link:
h = 1
y' = y
y(0) = 1
y(n+1) = y(n) + h * y'(n)
Are you saying you can't code that up in MATLAB with appropriate substitutions for your particular equation, range, starting point, and stepsize?
Sam
Sam am 7 Mär. 2014
Yes. Since I am new to matlab, I don't exactly know the codes to solve an IVP. But, I do know euler's method and such.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by