prepared by
Mark E. Johnson,
maejohns@math.princeton.edu

### Mathematics in Engineering I

# MATLAB Practice Problems

All problems on this page are taken directly from the textbook for
the course : the 6th edition of Boyce and diPrima. This will give
you a chance to reproduce some of the pictures they use in the text
by using *Matlab*.

### Problem 1

On Page 20, in Example 2, you should find the differential equation
y'-y/2=exp(-t)

Using Matlab, first reproduce the trajectories from Figure 2.1.3
on page 21 represeting the solution with initial condition **y(0)=-1**.
Then try to reproduce the entire picture by choosing several other initial
conditions and integrating, all the while plotting solutions on the same
**y vs. t** graph. (How do you print solutions on the same graph?
Take a look at the **hold** command by typing *help hold*)
Try labelling your axes and
maybe rescaling them so they are nice and pretty. *help axis*,
*help title*, *help xlabel*, etc. oughta do the trick...

Now print your solution. (you don't have to, but you should know how)

### Problem 2

On page 371, in Example 1 we have a linear system of equations
which can be rewritten as
x' = x + y
y' = 4x + y

Use *Matlab* to integrate this system and reproduce
some of the trajectories in Figure 7.5.2. Note that the
left plot is a phase portrait (**y vs. x**) and the
right portrait is a plot of **x vs. t**. (My notations
differs from that used in the text).
Again make sure you can plot multiple solutions on the same graph
and make sure you know how to print.

### Problem 3

Page 505, Example 1 gives a systems of equations
x' = x ( 1-.5 y )
y' = y ( -.75 + .25 x)

Try to (roughly) reproduce Figure 9.5.2 on page 507.