The monthly deposit into a saving account S needed to reach an investment goal B
ID: 3564194 • Letter: T
Question
The monthly deposit into a saving account S needed to reach an investment goal B can be calculated by the formula M=(r/1200)/(((1+r/1200)^12N)-1) where M is the monthly deposit, S is saving goal, N is a number of years, and r is the annual interest rate (%), Write a MATLAB user-defined function that calculates the monthly deposit into a saving account. For the function name and argument use M=invest(S,r,N). The input arguments are S, r and N. The output M is the amount of the monthly deposit. Use the function to calculate the monthly deposit for a 10-year investment if the investment goal is $25,000 and the annual interest rate is 4.25%
Explanation / Answer
function [M]=invest(S,r,N)
% where M is the monthly deposit, S is saving goal, N is a number of years
% and r is the annual interest rate (%)
S=input('Enter the value of S saving goal : ');
r=input('Enter the value of r annual interest rate in % : ');
N=input('Enter the value of N number of years : ');
M=S*(r/1200)/((1+r/1200)^(12*N)-1);
display('M is the monthly deposit : ');
display(M);
end
for the given example:-
Enter the value of S saving goal : 25000
Enter the value of r annual interest rate in % : 4.25
Enter the value of N number of years : 10
M is the monthly deposit :
M =
167.5522
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.