Write a function that can solve an ode using modified


Please Reply in matlab code that can be subbed straight into matlab is possible.

1. Numerically solve the ODE: y'= 10 - y^2 using ode45. Use a start time of 0, end time of 1, and an initial condition of 0.

2. Using a while loop, write a function that can solve an ODE using Modified Euler's method. This function will work similarly to ode45, but the step size will have to be specified as an input.

3. Add an if statement to your your function so that it doesn't overshoot the end time (i.e. change h in the final step to exactly reach the end time).
4. Adjust your function so that it has adaptive time stepping. If at any point exceeds 0.5, the value for h should be halved.

5. Solve the ODE from Q1 using your final function with a step size of 0.3. Plot the solution from and in the same figure. Comment on the accuracy of your numerical approximation, and discuss whether the requirements from Q3 and Q4 were met (ie. does it finish at exactly 1 s, and does the step size adapt).

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a function that can solve an ode using modified
Reference No:- TGS02893514

Expected delivery within 24 Hours