Question
1. Write a pseudocode (pen and paper) algorithm that solves the ODE y0 = f(t,y) using Eulers method. 2. Convert this algorithm into MATLAB syntax,
1. Write a pseudocode (pen and paper) algorithm that solves the ODE y0 = f(t,y) using Eulers method.
2. Convert this algorithm into MATLAB syntax, as the function euler method . (a) 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. (b) If hf(t,y) at any point exceeds 1, your function should halve the step size h. (c) Equally, if hf(t,y) at any point drops below 0.01, your function should double the step size h. (d)You should also make sure that the nal solution step doesnt overshoot tend. (i.e. change h during the nal step to exactly reach tend). (e)Also include a discussion of when the code could break, or give incorrect outputs (you DO NOT need to design your code to avoid these).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started