matlab code 20

1. Write a MATLAB code using for loop that will compute (as its only output) each of the following finite sum. Run it and give the answer (= the output).

(a) Suppose that Randall sets up a 401(k) retirement annuity that pays r = 6% interest, compounded annually. When he turns 35 years old, Randall deposits $3500, and each subsequent year he plans to deposit 5% more than the previous year (due to planned raises and better money management). He continues this until his 65th birthday (when he makes his last deposit and plans to retire). How much will Randall’s annuity be worth then?

(b) Repeat part (a) if the annual deposits are doubled.

(c) Repeat part (a) if the annual interest rate is doubled.

(d) Repeat part (a) if he starts the annuity ten years earlier (when he turns 25), but still continues until his 65th birthday.


2. Write a MATLAB code using while loop that will compute the following

(a) Suppose that Gomez takes out a loan for $22,000 to buy a new SUV (after trading in his car).

The bank charges 6% annual interest on the unpaid balance, compounded monthly (that’s 0.5% interest each month). If Gomez pays $300 at the end of each month, how many months will it take him to pay off his loan? What is the amount of his last payment? His last payment will just cover the unpaid balance so will likely be less than $300.

(b) If, in writing a while loop to solve this problem you accidentally typed 220000 (rather than 22000); i.e., you added an extra zero to the loan amount. Explain what would happen.