Question: a) Formulate the differential equation being solved. b) What is the initial condition? c) What is the stepsize? d) What numerical methods are implemented

a) Formulate the differential equation being solved. b) What is the initial 

a) Formulate the differential equation being solved. b) What is the initial condition? c) What is the stepsize? d) What numerical methods are implemented in the for-loop (Lines 6-21)? e) What numerical methods are implemented in the while-loop (Lines 11-19)? f) What is the time horizon over which the differential equation is being integrated? function HW5.P1 1 2 y = 2; 3 t = 0; 4 dt = le-2; 5 n = 1e3; 6 ysol = zeros(n,1); 7 for i=1:n 8 9 10 11 12 13 14 15 16 17 t = t + dt; yt = y; z=getz (y,yt,y,dt); k = 1; while abs(z)>le-8 xgetx (y,t, dt); y=y-2/x; z=getz (y, yt,t,dt); k = k + 1; if k>30 18 19 20 21. break end end ysol (i) = y; 22 end 23 plot (linspace (0, dt n,n),ysol) 24 end 25 function r getz (y,yt,t,dt) 26 ryytdt log ((y 3-2+y^2+3+y)) *exp(-1); 27 end 28 function dr getx (y,t,dt) 29 dr 1-dt (3*y 2-4 y+3)/(y 3-2+y^2+3+y) *exp(-t); 30 end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!