Question: Please make sure code follows all MATLAB rules An amount of money P is invested in an account where interest is compounded at the end
Please make sure code follows all MATLAB rules


An amount of money P is invested in an account where interest is compounded at the end of the period. The future worth F yielded at an interest rate i after n periods may be determined from the following formula: F = P(1+i) An Write a function that will calculate the future worth of an investment for each year from 1 through n. The input to the function should include the initial investment P, the interest rate i (as a decimal), and the number of years n for which the future worth is to be calculated. The output should consist of a table (created using the fprintf command) with headings and columns for number of years and the F value corresponding to each year. Your function will be tested using unknown (to you) values for P, n, and i so be sure that your function will run properly regardless of the inputted values. i function f=futureWorth(P, i,n) 2 3 4 5 6 7 fprintf(" year future worth '); fprintf('%50 %14.2f ',t); %t is a matrix consisting of values for n in column 1 and the corresponding F values in column 2 8 9 end 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
