Question

In: Computer Science

USING MATLAB: A simple mortgage calculator that will output the monthly payment, the remaining balance, and...

USING MATLAB:

A simple mortgage calculator that will output the monthly payment, the remaining balance, and so on.

years=30;
annual_rate=0.04; % 2.75% annual rate
house_value=500,000;
downpayment=3.5; % 25% down

and plot results

Solutions

Expert Solution

Code for mortgage function:

% L: size of the loan
% rate: annual rate
% years: length of loan in years
% 
% Outputs
% P: monthly payment
% In: list of interests paid over the entire loan period
% Ba: Remaining balane over the entire loan period
function [P,In,Ba]=mortgage(L,rate,years)
 
N=years*12;
r=rate/12; % monthly rate
%L*(1+r) = P + P/(1+r) + P/(1+r)^2 + P/(1+r)^3
%  = P (1-(1/1+r)^N)/(1-(1/(1+r))
P= L*(1+r)/((1-(1/(1+r))^N)/(1-1/(1+r)));
Ls(1)=L;
In(1)=0;
Ps(1)=0;
for i=2:N+1
    In(i)=Ls(i-1)*r;
    Ps(i)=P-In(i);
    Ls(i)=Ls(i-1)-Ps(i);
end
Ba=Ls(2:end);
In=In(2:end);

Code for creating a script which calls the function to calculate:

years=20;
annual_rate=0.04; % 4% annual rate
house_value=500000;
downpayment=0.25; % 25% down
loan_size=house_value*(1-downpayment);
[P,In,Ba]=mortgage(loan_size,annual_rate,years);
% close all
fprintf('Monthly Payment: %1.2f \nTotal Interest Paid: %1.2f\nBalance remaining: %1.2f',P,sum(In),house_value-sum(In)-downpayment*house_value);

(Feel free to ask if you have any doubts in the comments below)


Related Solutions

For this part you will need to use your calculator. What is the Monthly Mortgage Payment...
For this part you will need to use your calculator. What is the Monthly Mortgage Payment on a $125,000 Home with an 80% LTV with a 5% Interest Rate, 30-Year Fixed Rate Mortgage (Constant Payment Mortgage)? $536.82 What is the Monthly Mortgage Payment on a $125,000 Home with an 80% LTV with a 6% Interest Rate, 30-Year Fixed Rate Mortgage (Constant Payment Mortgage)? $599.55 How much more with the person with the mortgage in question #8 pay over the person...
Find the monthly payment and estimate the remaining balance. Assume interest is on the unpaid balance....
Find the monthly payment and estimate the remaining balance. Assume interest is on the unpaid balance. 5​-year computer loan for ​$2483 at 6.7​%; remaining balance after 2 years. The monthly payment is ​$
You have a mortgage with a remaining balance of $160,000 and 200 more monthly payments. The...
You have a mortgage with a remaining balance of $160,000 and 200 more monthly payments. The bank charges you 5% APR with monthly compounding on the loan. The current payments are $1,200 per month. Due to covid-19 you have lost your job and need to skip the payments in months 1 to 5 .The bank offers you two alternatives. In alternative 1 you will start making payments again, in month 6 but with new payments that take into account the...
Find the monthly payment and estimate the remaining balance(to the nearest dollar). Assume interest is on...
Find the monthly payment and estimate the remaining balance(to the nearest dollar). Assume interest is on the unpaid balance. 30-year car loan for $235,000 at 3.21%; remaining balance after 20 years.
Using the ENGR 315 Automobile Loan Payment Calculator posted, calculate the monthly payment required for a...
Using the ENGR 315 Automobile Loan Payment Calculator posted, calculate the monthly payment required for a 60-month new automobile loan made by the lender at 4.74% annual percentage rate (APR) if the car buyer borrowed $35,742. Save the resulting Excel spreadsheet file, as a PDF, presenting your payment calculations
Monthly Mortgage Payments The average monthly mortgage payment including principal and interest is 982 in the...
Monthly Mortgage Payments The average monthly mortgage payment including principal and interest is 982 in the United States. If the standard deviation is approximately 180 and the mortgage payments are approximately normally distributed, find the probabilities. Use a TI-83 Plus/TI-84 Plus calculator and round the answers to at least four decimal places. (a) (a)The selected monthly payment is more than $1400 (a)The selected monthly payment is more than 1400 P(Z>1400)= 2) Prison Sentences The average prison sentence for a person...
Calculate the monthly payment on a $220,000 mortgage if payment is made at the beginning of...
Calculate the monthly payment on a $220,000 mortgage if payment is made at the beginning of each month, and the annual interest rate is 3.75 percent for 20 years. Group of answer choices $1,304.35 $1,300.29 $1,319.25 $1,355.65
Using the maximum ratios for a conventional mortgage, how big a monthly payment could the Danforth...
Using the maximum ratios for a conventional mortgage, how big a monthly payment could the Danforth family afford if their gross (before-tax) monthly income amounted to $5,500? Would it make any difference if they were already making monthly installment loan payments totaling $650 on two car loans? Maximum mortgage payment they could make would be $  
1.(Level-Payment Mortgages) Compute the monthly payment on a 30-year level payment mortgage assuming an annual mortgage...
1.(Level-Payment Mortgages) Compute the monthly payment on a 30-year level payment mortgage assuming an annual mortgage rate of 5% and an initial mortgage principal of $400,000. (2147.29) 2.(Mortgage Pass-Throughs) Consider a $400 million pass-through MBS that has just been created (so the 'seasoning' of the pass-through is equal to 0). The underlying pool of mortgages each has a maturity of 20 years and an annual mortgage coupon rate of 6%. The pass-through rate of the mortgage pool is 5%. Assuming...
Calculating the Payment for a Constant Payment Mortgage (CPM) $100000 Mortgage 5% Interest 20 Years Monthly...
Calculating the Payment for a Constant Payment Mortgage (CPM) $100000 Mortgage 5% Interest 20 Years Monthly Payments If he wants to pay off the loan after 8 years, what would be the outstanding balance on the loan? Present Value Method
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT