image thumbnail

DebtRepaymentCalcul​ator

version 1.0.0 (2.44 KB) by Nicholas Albertson
Calculates how long it will take to pay off a debt given a set payment per period

69 Downloads

Updated 13 Nov 2018

View License

Simply run the script, enter a few parameters when prompted, and the debt repayment calculator does the rest!

The calculator will output a table showing the remaining balance, interest paid, cumulative interest paid, and cumulative payments made for each period. At the end, you get a summary explaining the number of periods required to pay off the balance, the interest paid, and total payments made. It gives the total amount paid as a percentage of the original amount owed and the date the account will be paid off if you start payments on the first of next month. Lastly, you get a plot showing you the total balance over time.

Required inputs:
-Starting balance - how much do you owe?
-Interest rate - what is the APR for the account? (If it is 20%, enter 20, not 0.2)
-Payment frequency - how often will you pay? Monthly, twice a month, every two weeks, or weekly? (Paying every two weeks or weekly instead of monthly or twice a month will result in extra payments per year, resulting in a faster debt repayment)
-Payment - how much do you want to pay each period?

Assumes interest is compounded daily, like most credit cards and student loans. Mortgage and car loans use amortized interest, which is not covered by this calculator, but it can still give you a good idea of how the repayment would work.

Example Output:
---------------------------------------------------------------------------------------------------------
Welcome to the debt-reduction calculator!

Assumes first payment is on the first of next month and interest is compounded daily.

What is your current balance? $5000
What is the annual interest rate (APR)? 18.99
How often would you like to pay? (1=monthly, 2=semi-monthly, 3=biweekly, 4=weekly) 1
How much would you like to pay per period? $200

Period Balance Interest IntToDate PayToDate
------------------------------------------------
1 4878.02 78.02 78.02 200.00
2 4746.65 68.63 146.65 400.00
3 4620.56 73.91 220.56 600.00
4 4490.08 69.52 290.08 800.00
5 4359.81 69.74 359.81 1000.00
6 4225.23 65.42 425.23 1200.00
7 4090.66 65.43 490.66 1400.00
8 3953.91 63.24 553.91 1600.00
9 3812.94 59.04 612.94 1800.00
10 3671.67 58.73 671.67 2000.00
11 3526.27 54.60 726.27 2200.00
12 3380.34 54.07 780.34 2400.00
13 3232.03 51.70 832.03 2600.00
14 3076.51 44.48 876.51 2800.00
15 2923.27 46.76 923.27 3000.00
16 2766.10 42.83 966.10 3200.00
17 2607.81 41.71 1007.81 3400.00
18 2445.68 37.87 1045.68 3600.00
19 2282.18 36.50 1082.18 3800.00
20 2116.03 33.85 1116.03 4000.00
21 1946.16 30.13 1146.16 4200.00
22 1774.54 28.38 1174.54 4400.00
23 1599.31 24.76 1199.31 4600.00
24 1422.05 22.75 1222.05 4800.00
25 1241.92 19.86 1241.92 5000.00
26 1057.20 15.29 1257.20 5200.00
27 871.13 13.93 1271.13 5400.00
28 681.69 10.55 1281.69 5600.00
29 489.52 7.83 1289.52 5800.00
30 294.07 4.55 1294.07 6000.00
31 95.60 1.53 1295.60 6200.00
32 0.00 0.00 1295.60 6295.60

If you pay $200 each period for 32 periods, you will pay
$1295.60 in interest and you will pay a total of $6295.60.

You are paying 126% of the borrowed amount.

This account will be paid off in 32 months (2.67 years),
ending on July 01, 2021.

Cite As

Nicholas Albertson (2021). DebtRepaymentCalculator (https://www.mathworks.com/matlabcentral/fileexchange/69412-debtrepaymentcalculator), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!