\[ \begin{align}\begin{aligned}\newcommand\blank{~\underline{\hspace{1.2cm}}~}\\% Bold symbols (vectors) \newcommand\bs[1]{\mathbf{#1}}\\% Poor man's siunitx \newcommand\unit[1]{\mathrm{#1}} \newcommand\num[1]{#1} \newcommand\qty[2]{#1~\unit{#2}}\\\newcommand\per{/} \newcommand\squared{{}^2} \newcommand\cubed{{}^3} % % Scale \newcommand\milli{\unit{m}} \newcommand\centi{\unit{c}} \newcommand\kilo{\unit{k}} \newcommand\mega{\unit{M}} % % Percent \newcommand\percent{\unit{\%}} % % Angle \newcommand\radian{\unit{rad}} \newcommand\degree{\unit{{}^\circ}} % % Time \newcommand\second{\unit{s}} \newcommand\s{\second} \newcommand\minute{\unit{min}} \newcommand\hour{\unit{h}} % % Distance \newcommand\meter{\unit{m}} \newcommand\m{\meter} \newcommand\inch{\unit{in}} \newcommand\foot{\unit{ft}} % % Force \newcommand\newton{\unit{N}} \newcommand\kip{\unit{kip}} % kilopound in "freedom" units - edit made by Sri % % Mass \newcommand\gram{\unit{g}} \newcommand\g{\gram} \newcommand\kilogram{\unit{kg}} \newcommand\kg{\kilogram} \newcommand\grain{\unit{grain}} \newcommand\ounce{\unit{oz}} % % Temperature \newcommand\kelvin{\unit{K}} \newcommand\K{\kelvin} \newcommand\celsius{\unit{{}^\circ C}} \newcommand\C{\celsius} \newcommand\fahrenheit{\unit{{}^\circ F}} \newcommand\F{\fahrenheit} % % Area \newcommand\sqft{\unit{sq\,\foot}} % square foot % % Volume \newcommand\liter{\unit{L}} \newcommand\gallon{\unit{gal}} % % Frequency \newcommand\hertz{\unit{Hz}} \newcommand\rpm{\unit{rpm}} % % Voltage \newcommand\volt{\unit{V}} \newcommand\V{\volt} \newcommand\millivolt{\milli\volt} \newcommand\mV{\milli\volt} \newcommand\kilovolt{\kilo\volt} \newcommand\kV{\kilo\volt} % % Current \newcommand\ampere{\unit{A}} \newcommand\A{\ampere} \newcommand\milliampereA{\milli\ampere} \newcommand\mA{\milli\ampere} \newcommand\kiloampereA{\kilo\ampere} \newcommand\kA{\kilo\ampere} % % Resistance \newcommand\ohm{\Omega} \newcommand\milliohm{\milli\ohm} \newcommand\kiloohm{\kilo\ohm} % correct SI spelling \newcommand\kilohm{\kilo\ohm} % "American" spelling used in siunitx \newcommand\megaohm{\mega\ohm} % correct SI spelling \newcommand\megohm{\mega\ohm} % "American" spelling used in siunitx % % Inductance \newcommand\henry{\unit{H}} \newcommand\H{\henry} \newcommand\millihenry{\milli\henry} \newcommand\mH{\milli\henry} % % Power \newcommand\watt{\unit{W}} \newcommand\W{\watt} \newcommand\milliwatt{\milli\watt} \newcommand\mW{\milli\watt} \newcommand\kilowatt{\kilo\watt} \newcommand\kW{\kilo\watt} % % Energy \newcommand\joule{\unit{J}} \newcommand\J{\joule} % % Composite units % % Torque \newcommand\ozin{\unit{\ounce}\,\unit{in}} \newcommand\newtonmeter{\unit{\newton\,\meter}} % % Pressure \newcommand\psf{\unit{psf}} % pounds per square foot \newcommand\pcf{\unit{pcf}} % pounds per cubic foot \newcommand\pascal{\unit{Pa}} \newcommand\Pa{\pascal} \newcommand\ksi{\unit{ksi}} % kilopound per square inch \newcommand\bar{\unit{bar}} \end{aligned}\end{align} \]

Oct 24, 2024 | 618 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:

(13.2)#\[A = \frac{P[r(1+r)^n]}{(1+r)^n-1}\]

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:

(13.3)#\[S(t) = A \sum_{k=1}^{t} (1+r)^{-(n-k+1)}\]

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#

  1. Open the MATLAB Template and fill out the header information. Then save the file as ma2_ind_2_username.m

  2. In %% INITIALIZATION, define variables for the principal ($\(500,000\)), annual interest rate (\(7\%%\)), and get user input for the time for repayment (in years).

  3. In %% CALCULATIONS, complete the following instructions. Make sure to use at least 1 for loop in your calculations:

  • 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 payments on the principal is greater than or equal to the payments on the interest.

  1. 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 using fprintf and disp.

  2. 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.)

Sample Output#

Use the values in Table 13.7 below to test your program.

Table 13.7 Test Cases#

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.