Write Matlab codes for the Euler method, the improved Euler method, and the clas
ID: 2978849 • Letter: W
Question
Write Matlab codes for the Euler method, the improved Euler method, and the classical Runge-kutta method that can be applied to initial value problems dy/dt = f(t,y) in a t b, y(a) = y0, with fixed constant step-size h. Apply your codes to solve dy/dy = ty, y(0) = 1, on 0 t 1 with step-size h = 0.001. Compute and plot the error. This should help you to debug your codes. Apply your codes to the equation dy/dt = 1.8/t4 - y2, y(1) = -1, over the interval 1 t 2. Plot the solution. Try different step-sizes. Try to determine a t-value where the solution becomes maximal.Explanation / Answer
for Eular method
%function t=t(n,t0,t1,y0) function y=y(n,t0,t1,y0) h=(t1-t0)/n; t(1)=t0; y(1)=y0; for i=1:n t(i+1)=t(i)+h; y(i+1)=y(i)+h*ex(t(i),y(i)); end; V=[t',y'] plot(t,y) title('satya')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.