11.
(a)
1/(1+exp(-t)*C1)
syms x0; sol
= dsolve('Dx = x - x^2', 'x(0) = x0')
1/(1-exp(-t)*(-1+x0)/x0)
-x0/(-x0-exp(-t)+exp(-t)*x0)
0
solcurves = inline(vectorize(bettersol), 't', 'x0');
for initval = 0:0.25:2.0
plot(T, solcurves(T,
initval))
end
axis tight
title 'Solutions of Dx = x - x^2, with x(0) = 0, 0.25,…, 2'
xlabel 't'
ylabel 'x'
hold off
The
graphical evidence suggests that: The solution that starts at zero stays there;
all the others tend toward the constant solution 1.
(c)
f = inline('[x(1) - x(1)^2 - 0.5*x(1)*x(2); x(2) - x(2)^2 -
0.5*x(1)*x(2)]', 't', 'x');
for a = 0:1/12:13/12
for b = 0:1/12:13/12
[t, xa] = ode45(f, [0
3], [a,b]);
plot(xa(:, 1), xa(:, 2))
echo off
end
end
axis([0 13/12 0 13/12])
(d)
The
endpoints on the curves are the start points.
So clearly any curve that starts out inside the first quadrant, that is
one that corresponds to a situation in which both populations are present at
the outset, tends toward a unique point—which from the graph appears to be
about (2/3,2/3). In fact if x = y
= 2/3, then the right side of both equations in (4) vanishes, so the
derivatives are zero and the values of x(t)
and y(t) remain constant—they don't
depend on t. If only one species is present at the
outset, that is you start out on one of the axes, then the solution tends
toward either (1,0) or (0,1) depending whether x or y is the species
present. That is precisely the behavior
we saw in part (b).
(e)
f = inline('[x(1) - x(1)^2 - 2*x(1)*x(2); x(2) - x(2)^2 -
2*x(1)*x(2)]', 't', 'x');
for a = 0:1/12:13/12
for b = 0:1/12:13/12
[t, xa] = ode45(f, [0
3], [a,b]);
plot(xa(:, 1), xa(:, 2))
echo off
end
end
axis([0 13/12 0 13/12])
This
time most of the curves seem to be tending toward one of the points (1,0) or
(0,1)—in particular, any solution curve that starts on one of the axis
(corresponding to no initial poulation for the other species) does so. It seems that whichever species has a
greater population at the outset will eventually take over all the
population—the other will die out. But
there is a delicate balance in the middle—it appears that if the two
populations are about equal at the outset, then they tend to the unique
population distribution at which, if you start there, nothing happens. That value looks like (1/3,1/3). In fact that is the value that renders both
sides of (5) zero—analogous to the role (2/3,2/3) had in part (d).
(f)
It
makes sense to refer to the model (4) as "peaceful coexistence", since
whatever initial populations you have—provided both are present—you wind up
with equal populations eventually.
"Doomsday" is an appropriate name for model (5), since if you
start out with unequal populations, then the smaller group becomes
extinct. The lower coefficient 0.5
means relatively small interaction between the species, allowing for
coexistence. The larger coefficient 2
means stronger inteaction and competition precluding the survival of both.
12.
Here
is a SIMULINK model for redoing the Pendulum application from Chapter 9:
With
the initial conditions x(0) = 0, (0) = 10, the XY Graph block shows the following phase
portrait:
Meanwhile,
the Scope block gives the following graph of x as a function of t:
Here
is a SIMULINK model for studying the equation of motion of a baseball:
The
way this works is fairly straightforward.
The Integrator block in the upper left integrates the acceleration (a
vector quantity) to get the velocity (also a vector – we have chosen the
option, from the Format menu, of
indicating vector quantities with thicker arrows). This block requires the initial value of the velocity as an
initial condition; we define it in the "initial velocity" Constant
block. Output from the first Integrator
goes into the second Integrator, which integrates the velocity to get the
position (also a vector). The initial
condition for the position, [0, 4], is stored in the parameters of this second
Integrator. The position vector is fed
into a Demux block, which splits off the horizontal and vertical components of
the position. These are fed into the XY
Graph block, and also the vertical component is fed into a scope block so that
we can see the height of the ball as a function of time. The hardest part is the computation of the
acceleration:
This
is computed by adding the two terms on the right with the Sum block near the
lower left. The value of [0, -g] is stored in the
"gravity" Constant block. The
second term on the right is computed in the Product block labeled "Compute
acceleration due to drag," which multiplies the velocity (a vector) by -c times the speed (a
scalar). We compute the speed by taking
the dot product of the velocity with itself and then taking the square root;
then we multiply by -c in
the Gain block in the middle bottom of the model. The Scope block in the lower right plots the ball's speed as a
function of time.
(a)
With
c set to 0 (no air resistance) and
the initial velocity set to [80, 80], the ball follows a familiar parabolic
trajectory, as seen in the following picture:
Note that the ball travels about 400 feet before hitting the ground, so the trajectory is just about what is required for a home run in most ballparks. We can read off the flight time and final speed from the other two scopes:
Thus
the ball stays in the air about 5 seconds and is traveling about 115 ft/sec
when it hits the ground.
Now
lets' see what happens when we factor in air resistance, again with the initial
velocity set to [80, 80]. First we take
c = 0.0017. The trajectory now looks
like this:
Note
the enormous difference air resistance makes; the ball only travels about 270
feet. We can also investigate the
flight time and speed with the other two scopes:
So
the ball is about 80 feet high at its peak, and hits the ground in about 4½
seconds. Its final speed can be read
off from the picture:
So
the final speed is only about 80 ft/sec, which is much gentler on the hands of
the outfielder than in the no-air-resistance case.
(b)
Let's now redo exactly the same calculation with c = 0.0014 (corresponding to playing in Denver). The ball's trajectory is now:
The
ball goes about 285 feet, or about 15 feet further than when playing at sea
level. This particular ball is probably
an easy play, but with some hard-hit balls, those extra 15 feet could mean the
difference between an out and a home run.
If we look at the height scope for the Denver calculation, we see:
so
there is a very small increase in the flight time. Similarly, if we look at the speed scope for the Denver
calculation, we see:
so
the final speed is a bit faster, about 83 ft/sec.
(c)
One
would expect that batting averages would be higher in Denver, as indeed is the
case according to Major League Baseball statistics.