Problem #1
An amount of money P is invested in an account where interest is compounded at the end of the
period. The future worth F yielded at an interest rate i after n periods may be determined from the
following formula:
F = P(1 + i)$^n$
Write an M-file that will calculate the future worth of an investment for each year from 1 through
n. The input to the function should include the initial investment P, the interest rate i (as a decimal),
and the number of years n for which the future worth is to be calculated. The output should consist
of a table with headings and columns for n and F. Run the program for P = $100,000, i = 0.05, and
n = 10 years.
Problem #2
F = P(1 + i)$^n$
P = $100,000 i = 0.05 n = 10
1:10
Piecewise functions are sometimes useful when the relationship between a dependent and an
independent variable cannot be adequately represented by a single equation. For example, the
velocity of a rocket might be described by
$\begin{cases}
10t^2 - 5t & 0 \le t \le 8 \\
624 - 3t & 8 \le t \le 16 \\
v(t) = 36t + 12(t - 16)^2 & 16 \le t \le 26 \\
2136e^{-0.1(t - 26)} & t > 26 \\
0 & \text{otherwise}
\end{cases}$
Develop an M-file function to compute v as a function of t. Then, develop a script that uses this
function to generate a plot of v versus t for t = -5 to 50.