Answered step by step
Verified Expert Solution
Question
1 Approved Answer
18. The lump sum S to be paid when interest on a loan is compounded annually is given by S=P[1 + i], where P
18. The lump sum S to be paid when interest on a loan is compounded annually is given by S=P[1 + i]", where P is the principal invested, i is the interest rate, and n is the number of years. Write a program that will plot the amount S as it increases through the years from 1 to n. The main script will call a function to prompt the user for the number of years (and error-check to make sure that the user enters a positive integer). The script will then call a function that will plot S for years 1 through n. It will use 0.05 for the interest rate and $10,000 for P. 1 2 3 4 in 00 function plot LumpSum(n) int=0.05; 5 S=P*(1+int).^H; 6 plot (H,S,'r-*') xlabel('Year') 7 8 9 0 P=10^4; H=1:n; ylabel('Lump Sum S') title('plot of 5 for years 1 thorugh n') end Command Window Error in Hw_4_Problem_3 (line 4) Y=1:n; >> Hw_4_Problem_3 Not enough input arguments. Error in Hw_4_Problem 3 (line 4) |H=1:n; >> Hw_4_Problem_3 >> Hw_4_Problem_3 Not enough input arguments. Error in Hw_4_Problem_3 (line 4) H=1:n; >> Hw_4_Problem_3 Not enough input arguments. Error in Hw 4 Problem 3 (line 4) H=1:n;
Step by Step Solution
★★★★★
3.41 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
function plotLumpSumn int 005 P 1e4 10000 H 1n S P 1 int H plotH S r xlabelYear ylabelLump ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started