Dec 03, 2024 | 648 words | 6 min read
13.3.2. Task 2#
Introduction#
Engineers regularly perform economic analyses on potential purchases needed for their projects. You are part of team working on a manufacturing productivity improvement project. Moreover, you are planning to take out an amortized loan to pay for necessary equipment and training. As part of the purchase and cost analysis, you must determine some information about expected payments for the loan.
Amortization is one common type of loan processing. The loan has fixed payments over its life, and the payments are applied to both interest accrued and the original principle. The interest is calculated on the existing principle at the end of each payment period. Early payments in an amortized loan are mostly paying accrued interest with only small amounts paying down the original principle. Over time, the size of the interest component of the total payment decreases and the size of the principal component increases.
You can calculate the fixed payment amount on an amortized loan using the equation:
Where
\(P\) is the principal amount of the loan (i.e., the amount borrowed)
\(n\) is the number of total payments for the life of the loan
\(r\) is an interest rate that applies to each payment period (e.g., percentage per month when n payments are made as the monthly payment). This is called a periodic interest rate, and it’s written in a decimal, not a percentage.
You may want to know how much original loan (the principal) has been paid back after some number of payments, \(t\). This is called the cumulative principal payment, \(S\). For example: You have a loan with a $\(1000/month\) payment. For the first three payments, the amount you paid towards principle was $\(100\), then $\(120\), and then $\(145\). Your cumulative principal payments for those months were $\(100\), $\(220\), and $\(365\). A general equation to calculate the cumulative principal payment is:
Where
\(S(t)\) is the cumulative principal payment after payment \(t\). Click here for help with summation notation.
Here, you expect the project will take out a loan with a principle of $\(500,000\), with an annual interest rate of \(7\%%\), and will be repaid in equal monthly installments over a period of \(n\) years, where \(n\) will be determined by user input. Use MATLAB to write a script that will determine the cumulative principal payments at each monthly interval.
Task Instructions#
Open the MATLAB Template and fill out the header information. Then save the file as ma2_ind_2_username.m
In
%% INITIALIZATION
, define variables for the principal ($\(500,000\)), annual interest rate (\(7\%%\)), and get user input for the time for repayment (in years).In
%% CALCULATIONS
, complete the following instructions. Make sure to use at least 1for
loop in your calculations:Determine a vector of the cumulative total payments that have been paid toward the loan at each month for the entire loan period.
Determine a vector of the cumulative principal payments that have been paid at each month for the entire loan period.
Determine the total interest paid back on the loan (i.e. the amount over $\(500,000\) paid back).
Determine the number of payments that are made before the payment on the principal is greater than or equal to the payment on the interest.
In the
%% OUTPUTS
section, display the principal, interest rate, and time of repayment (in years) that the user entered, the vectors for cumulative total payments and cumulative principal payments, the total amount repaid, and the total interest paid back usingfprintf
anddisp
.Publish your script as ma2_ind_2_username.pdf and submit your deliverables to Gradescope. (Note: MATLAB will produce an error if you try to publish a script that requires user input. Before you publish, comment out your input statement and hard code the time for repayment as 30 years.)
Create and add the flow chart to ma2_ind_username.pdf
Sample Output#
Use the values in Table 13.7 below to test your program.
Case |
repayment period |
---|---|
1 |
15 |
2 |
30 |
Ensure your program’s output matches the provided samples exactly. This includes all characters, white space, and punctuation. In the samples, user input is highlighted like this for clarity, but your program should not highlight user input in this way.
Case 1 Sample Output
>> ma2_ind_2_username Input the number of years for repayment. 15 The principal amount is $500000. The annual interest rate is 7.00%. The repayment period is 15 years. The total amount repaid is $808945.44. The total amount of interest paid is $308945.44. The payments on the principal exceed the payments on the interest after 62 months.
Case 2 Sample Output
>> ma2_ind_2_username Input the number of years for repayment. 30 The principal amount is $500000. The annual interest rate is 7.00%. The repayment period is 30 years. The total amount repaid is $1197544.49. The total amount of interest paid is $697544.49. The payments on the principal exceed the payments on the interest after 242 months.