程序代写代做 graph Name:

Name:
MATLAB Assignment #1 Slope Fields and Euler’s Method
1. For the following differential equations
y′(t) = cos(y) + sin(t) (1)
y′(t) = y∗(2−y) (2) a) Modify the function F.m in MATLAB to match the given differential equation above.
b) Use the file ExampleSlopeField.m to generate a slope field of the differential equation, and print out your figure. Constrain the dimensions of your plot to be −4 ≤ y ≤ 4 and −4 ≤ t ≤ 4 and the spacing between the slope lines should be 0.5.
c) On your printed out slope field, sketch the solution of the differential equation at the following points:
1. (y1,t1)=(−2,−1.5) 2. (y2,t2)=(−1,−0.5) 3. (y3,t3)=(0,4)
d) For each of the initial points above, continue the solution curve backwards in time to see where the initial point originated from.
(Continued on the next page.)

2. Below is a slope field for the differential equation y′(t) = y ∗ sin(t ∗ π/2).
a) Modify the function F.m in MATLAB so that it is defined as F (t, y) := y ∗ sin(t ∗ π/2). Use this function in the command window to help you compute Euler’s method for 6 steps starting at (y0, t0) = (1, 0) with step size 1. Plot your result on the graph above.
k tk yk f(tk,yk) 0
1
2
3 4 5 6
b) Modify the ExampleEuler.m file so that you numerically integrate the initial condition (y0, t0) = (1, 0) until time t = 25. Do this for step sizes 0.5, 0.1 and 0.01.
c) For each of the step sizes, what is the value Euler’s method produces for y(25)? Include three significant digits. What pattern do you notice?