Consider the ODE y\' = -5y with initial condition y(0) = 1. We will solve this O
ID: 3110491 • Letter: C
Question
Consider the ODE y' = -5y with initial condition y(0) = 1. We will solve this ODE numerically using a step size of h = 0.5. (a) Are solutions to this ODE stable? (b) Is Euler's method stable for this ODE using this step size? (c) Compute the numerical value for the approximate solution at t = 0.5 given by Euler's method. (d) Is the backward Euler method stable for this ODE using this step size? (e) Compute the numerical value for the approximate solution at t = 0.5 given by the backward Euler method.Explanation / Answer
This is the code:
P=50;
dt=0.01;
f=@(ys) -5*ys;
y(1)=1;
t(1)=0;
for j=1:P
t(j+1)=t(j)+dt;
y(j+1)=y(j)+dt*f(y(j));
end
(a) Solutions to this ODE is stable because of y'(0)<0.
(b) Euler's method is not stable for this ODE using 0.5 step size.
(c) y(0.5) = 0.076944975276713
(d) Backward Euler method is stable for this ODE using 0.5 step size.
(e) y(0.5) = 1/3.25 = 0.307692307692308
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.