Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a pseudocode (pen and paper) algorithm that solves the ODE y0 = f(t; y) us

ID: 668288 • Letter: W

Question

Write a pseudocode (pen and paper) algorithm that solves the ODE y0 =f(t; y) using Euler’s method.

Convert this algorithm into MATLAB syntax, as the function euler method .

Your inputs should be the start time t0, the end time tend, the function f, an
initial condition y0 and an initial step size h.
If h f(t; y) at any point exceeds 1, your function should halve the step size
h.
Equally, if hf(t; y) at any point drops below 0:01, your function should double
the step size h.
You should also make sure that the final solution step doesn’t ‘overshoot’
tend. (i.e. change h during the final step to exactly reach tend).
Your MATLAB code should use the function header below, and be well-commented
with a sensible layout.
Include your pseudocode algorithm, as well as the MATLAB code. Also include
a discussion of when the could could break, or give incorrect outputs
(you DO NOT need to design your code to avoid these).

Explanation / Answer

Euler’s method
    initial value problem

     dy/dt=f(f,y)    ; y(a) =1

We will assume that this has a unique solution
y(a+h)o^y(a)+h dy/dt(a)
                                                                          
The value of this solution at
y(a+h)0^y(a)+hf(a,y(a))

we define t0:=a,y0:=y(a),t1:=a+h, we can express the above result in the following way

y1:=y0+hf(t0,y0)

gives an approximation to y(t1). This method of approximating the solution to an initial value problem is usually called Euler’s method. Theabsolute error(or sometimes just error )"and the relative error"rin this approximation are"= "r=

E=|y(t),y|,Er=|y(t),y1|/y(t)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote