Menu

Exercise 3 Following Code Snippet Produce Slope Field Ode Dy F T Y Y 0 2 0 Q43873000

Exercise 3 The following code snippet will produce a slope field for the ODE dy = f(t,y), y(0) = 2, 0<t<3 where f(t, y) =1-e

Run Code Snippet 1 and by adapting your answers from Exercise 2, plot a numerically approximated solution to the IVP over the

Exercise 4 A second order ODE of the form z +2 – z= cos(t) can be expressed as the coupled system of equations 2=y y=-y+z+

Exercise 3 The following code snippet will produce a slope field for the ODE dy = f(t,y), y(0) = 2, 0<t<3 where f(t, y) =1-e 4 – 2y. Show/hide Code Snippet 1 WN % Interval bounds tmin =; tmax = 3; ymin=0; ymax=2; % Grid spacing spacing= 0.3; O OVO % Define x and y coordinates [pt, py] – meshgrid(tmin: spacing: tmax,ymin: spacin % Calculate slopes ydash = 1-exp(-4*pt)-2*py; % Define slope vector components dt = (spacing/2)./sqrt(1+ydash.^2); dy = ydash. *dt; % Create slope field q = quiver(pt, py, dt, dy, ‘b’, ‘AutoScale’,’off’); set(q, ‘ShowArrowHead’, ‘off’, ‘LineWidth’,1) % Set axis and labels axis([tmin tmax ymin ymax]) xlabel(‘x’) 26 | ylabel(”) Run Code Snippet 1 and by adapting your answers from Exercise 2, plot a numerically approximated solution to the IVP over the top of the slope field. Run Code Snippet 1 and by adapting your answers from Exercise 2, plot a numerically approximated solution to the IVP over the top of the slope field. Save your figure as a PNG image and submit using the following prompt. Show/hide tip on saving as a PNG To save the current figure as a PNG you can use the command: print(‘module10.png’,’-dpng’) or simply select Save As… from the Figure Window. But be careful! Make sure you select the .png file type when you save your figure. Choose File No file chosen Upload your PNG 0% From looking at your plot do you think the numerically approximated solution is accurate? Explain. Enter answer Exercise 4 A second order ODE of the form z” +2′ – z= cos(t) can be expressed as the coupled system of equations 2=y y’=-y+z+cos(t) Define a vector Y as Y= (3) The derivative of Y is a vector whose entries correspond to the coupled equations: 7 ) -y +2+ cos(t) / Y’ = (?) = ( Using the following template snippet as a starting point, write an anonymous function that computes the vector Y’ at any input values of t and Y = () Show/hide Code Snippet 2 % z is Y(1), y is Y(2) seCODE = @(t,Y) [function for zdash; function for ydash]; Copy and paste your finished function into the text box: Paste code Show transcribed image text Exercise 3 The following code snippet will produce a slope field for the ODE dy = f(t,y), y(0) = 2, 0

Expert Answer


Answer to Exercise 3 The following code snippet will produce a slope field for the ODE dy = f(t,y), y(0) = 2, 0…

OR