In: Accounting
Please note that if n is in months, then r has to be the monthly rate. The monthly rate can be found by taking the annual percentage rate (APR) and dividing by 12.
a) Write a function payment that takes in PV, r, and n as inputs, and outputs the payment P.
b) Use the function you wrote above to create a loan amortization table. A loan amortization table will show how much principal is left after each payment and how much interest is paid with each payment. The columns should be principal paid, interest paid, cumulative principal, cumulative interest, and principal balance. So for the loan above, the amortization table would look like:
Principal Paid Interest Paid Cumulative Prin Cumulative Int Principle Balance
128.80 83.33 128.80 83.33 19871.20
matlab