Math 442 Assignment 5 - Spring 2015 Due Friday, March 13th

advertisement
Math 442 Assignment 5 - Spring 2015
Due Friday, March 13th
Directions: Use MATLAB to obtain solutions to the following problems. In Problems 1–4,
you may enter your commands directly in the Command Window, or write script M-files
with your commands. If you enter the commands directly in the Command Window, then
print a diary session of your commands and the figures they produce. If you write script
M-files, then print your scripts as well as the figures they produce. For Problems 5–9, print
your function and script M-files and they figures they produce. All figures should include
appropriate axis labels and a title. Figures with multiple plots should include a legend. You
will hand in your solutions on Friday, March 13th at the beginning of class.
1. Use dsolve to find the general solution of
dy
= −2ty 2 .
dt
Plot the solutions subject to the initial conditions y(0) = 0.2, . . . , 2 using increments
of 0.2 on the same graph. (You may want to use a for loop).
2. Use dsolve to find a solution of the initial value problem
sin x
2
2 cos x
d2 y
=
,
y(0) = 2,
1− 2 +
2
dx
x
x
x2
y 0 (0) = 0.
Plot the solution for −50 < x < 50.
3. Use dsolve to find a solution of the system
dx
= 2x + 3y − 2z
dt
dy
= x+y+z
dt
dz
= 3x − 3y + 4z
dt
subject to the initial conditions x(0) = 1, y(0) = 2, and z(0) = 3. Plot the solutions
on the interval [0, 10] on the same graph.
4. Let x(t) denote the position of a mass in a mass-spring system and p(t) denote the
momentum. Consider the following model where the system is governed by a damped
oscillator equation:
2x00 + x0 + 8x = 0,
p0 = −p − 8x.
Use dsolve to find the solutions x(t) and p(t) of this system subject to the initial
conditions x(0) = 2, x0 (0) = p(0) = 0. Plot the solutions on the interval [0, 10] and
generate a phase portrait in the xp-plane.
1
5. Use ode45 to solve the system
dx
= y − x2
dt
dy
= −x(1 + y)
dt
subject to the initial conditions x(0) = 0 and y(0) = 1 on the interval [0, 10]. Plot x(t)
and y(t) on a single graph and generate a phase portrait in the xy-plane. Draw arrows
on the solution trajectory to indicate the direction of increasing t.
6. Consider the initial value problem
d2 y
dy
= sin(4.3t),
y(0) = y 0 (0) = 0.
+
16
dt2
dt
Convert this second-order differential equation into a system of two first order equations
and use ode45 to solve the system on the interval [0, 2π]. Plot the solutions of your
system on a single graph and generate a phase portrait. Draw arrows on the solution
trajectory to indicate the direction of increasing t.
7. Consider the initial value problem
y 00 − 2y 0 + y = e−t ,
y(0) = 2,
y 0 (0) = 0.
Convert this second-order differential equation into a system of two first-order equations
and use ode45 to solve the system on the interval [0, 2π]. Plot the solutions of your
system on a single graph and generate a phase portrait. Draw arrows on the solution
trajectory to indicate the direction of increasing t.
8. The Lotka-Volterra predator-prey model is given by
dx
= (a1 − b1 y)x,
dt
dy
= (−a2 + b2 x)y.
dt
Use ode45 to solve this system with parameter values a1 = 3, a2 = 2.5, b1 = 2, and
b2 = 1 and initial conditions x(0) = y(0) = 1. Plot the solutions x(t) and y(t) on
[0, 6], using a solid blue line for the prey and a dashed red line for the predators.
Generate a phase portrait in the xy-plane illustrating two trajectories corresponding
to x(0) = y(0) = 1 and x(0) = y(0) = 1.5. Draw arrows on the solution trajectories to
indicate the direction of increasing t.
9. Consider the initial value problem
dy
xy
= 2
,
dx
x +1
y(1) = 0.
Use separation of variables to find the exact solution of this initial value problem. Use
Euler’s Method with n = 5 to solve this initial value problem on [0, 3]. Plot the exact
solution and numerical estimate on the same figure.
2
Download