Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In MATLAB The balance of a loan, B, after n monthly payments is given by B = A (

ID: 3848364 • Letter: I

Question

In MATLAB

The balance of a loan, B, after n monthly payments is given by B = A (1 + r/1200)^n P/r/1200[(1 + r/1200)^n - 1)] where A is the loan amount, P is the amount of a monthly payment, and r is the yearly interest rate entered in (e.g., 7.5% entered as 7.5). Consider a 5-year $20,000 car loan with 6.5% yearly interest that has a monthly payment of $391.32. Calculate the balance of the loan after every 6 months (i.e., at n =6 12, 18, 24, ....., 54, 60). Each time, calculate the percent of the loan that is already paid. White the results to an output text file ("loan txt") in a three-column table, where the first column displays the month and the second and third columns display the corresponding value of B and percentage of the loan that is already paid, respectively Include an appropriate header for the table.

Explanation / Answer

Matlab code:

time = double(12*5);
A = double(20000);
r = double(6.5);
P = double(391.32);

fileID = fopen('loan.txt','w');
fprintf(fileID,'Months B Percetage_paid ');

for n = 6:6:time
future_value = A*( ( 1 + r/1200)^n );
future_value_paid = ( P/(r/1200) )*(( 1 + r/1200)^n - 1);
B = future_value - future_value_paid;
pertg_paid = 100*(future_value_paid/future_value);
fprintf(fileID,'%d %d %d ',n,B,pertg_paid);
end
fclose(fileID);

Output loan.txt:

Months    B    Percetage_paid
6    18278.9    11.5202
12    16501.1    22.673
18    14664.8    33.4701
24    12768    43.9229
30    10808.6    54.0423
36    8784.76    63.8389
42    6694.22    73.3232
48    4534.8    82.5049
54    2304.25    91.3938
60    0.209504    99.9992

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote