Wednesday, February 8, 2012

2.8

An amount of money P is invested in an account where interest is compounded at the end of a 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 a program that will calculate the future worth of an investment for each year from 1 to 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. Run for  P = 100,000, i = .06 and n = 5 years.



P = 100000;
i = .06;
n = 1:5; % years

F=P*(1+i).^n;

plot(F);

This produces the result of

F =

   1.0e+05 *

    1.0600    1.1236    1.1910    1.2625    1.3382

And so the answer, after 5 years, is 133820

No comments:

Post a Comment